<jupyter_start><jupyter_text>```RProperty('location', 'Spain'),        RProperty('start', -1500),        RProperty('end', -714)```<jupyter_code># number, None, or something else

def classify_start(x):
    if x is None:
        return 'None'
    elif x is np.nan:
        return 'Nan'
    try:
        x1 = np.float(x)
        return 'Number'
    except:
        return 'Other'
    

classify_start(1), classify_start(None), classify_start(np.nan), classify_start('hello')
ddf.start.apply(classify_start).value_counts()
def possible_spatial_temporal(location, start, stop, 
                              location_strict=False,
                              start_strict=False,
                              stop_strict=False):

    def f(row):
        
        location_ok = False
        if location_strict:
            if ((row['spatialCoverageDescription'] is not None) and
                (location is not None) and (row['spatialCoverageDescription'] == location)):
                location_ok = True
        else:  # location_strict False
            if ((row['spatialCoverageDescription'] is None) or
                (location is None) or 
                (row['spatialCoverageDescription'] == location)):
                location_ok = True

        start_ok = False
        if start_strict:
            if ((row['stop'] is not None) and
                (start is not None) and
                (np.float(start) <= np.float(row['stop']))):
                start_ok = True
        else: 
            if ((row['stop'] is None) or
                (start is None) or 
                (np.float(start) <= np.float(row['stop']))):
                start_ok = True

        stop_ok = False
        if stop_strict:
            if ((row['start'] is not None) and
                (stop is not None) and
                (np.float(stop) >= np.float(row['start']))):
                stop_ok = True
        else:
            if ((row['start'] is None) or
                (stop is None) or 
                (np.float(stop) >= np.float(row['start']))):
                stop_ok = True
            
        return location_ok and start_ok and stop_ok
    
    return f
ddf.head()
location = "Cyprus"
start = 300
stop = 749


ddf[ddf.apply(possible_spatial_temporal(location,start,stop, location_strict=True), axis=1)]
# get ids for https://test.perio.do/#/p/Canonical/periodCollections/p0dg76f/
# Pyla-Koutsopetria I : archaeological survey of an ancient coastal town.


ddf[ddf.source_partOf_id == 'http://www.worldcat.org/oclc/892462417']['id']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11904761904761904, 'fraction_numerical': 0.01092896174863388, 'mean_word_length': 1.909194097616345, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '189059', 'license': 'Apache-2.0', 'n_tokens_mistral': 808, 'n_tokens_neox': 738, 'n_words': 181, 'path': 'notebooks/analysis_of_reconciliation_data.ipynb', 'repo_name': 'periodo/periodo-reconciler-py', 'size': '2562'}