<jupyter_start><jupyter_text>Shapefile<jupyter_code>with open(os.path.join('..', 'data','shapefiles','Nakhon-Si-Thammarat.geojson')) as f:
    data = json.load(f)
for i, feature in enumerate(data['features']):
    prop = feature['properties']

    province = prop['PV_TN']
    district = prop['AP_TN']
    subdist = prop['TB_TN']
    
    df_tmp = df_larval.loc[(df_larval['province'] == province) & 
                       (df_larval['district'] == district)]
    province_en, district_en = df_tmp[['province_en','district_en']].values[0]
    
    prop['PV_EN'] = province_en
    prop['AP_EN'] = district_en
data['features'][2]['properties']
with open(os.path.join('..', 'data', 'shapefiles', 'Nakhon-Si-Thammarat-en.geojson'), 'w') as FILE:
    json.dump(data, FILE, indent=4, ensure_ascii=False, sort_keys=True)<jupyter_output><empty_output><jupyter_text>Dictonary file<jupyter_code>province_entry = []
for feature in data['features']:
    prop = feature['properties']
    
    province_entry.append([
        prop['PV_TN'],
        prop['AP_TN'],
        prop['TB_TN'],
        prop['PV_EN'],
        prop['AP_EN'],
        prop['TB_EN'],
    ])
    
province_entry = pd.DataFrame.from_records(province_entry, columns=['province_th', 'district_th', 'subdist_th',
                                                                   'province_en', 'district_en', 'subdist_en'])

province_entry.to_csv(os.path.join('..', 'data', 'shapefiles', 'Nakhon-Si-Thammarat-dictionary.csv'))
province_entry.head()<jupyter_output><empty_output><jupyter_text>Detection file<jupyter_code>with open(os.path.join('..', 'data','breeding-sites','detection.geojson')) as f:
    detection = json.load(f)
for feature in tqdm_notebook(detection['features']):
    prop = feature['properties']
    
    province = prop['province']
    district = prop['district']
    subdist = prop['subdist']

    df_tmp = province_entry.loc[
        (province_entry['province_th'] == province) & 
        (province_entry['district_th'] == district) &
        (province_entry['subdist_th'] == subdist)
    ]
    
    province_en, district_en, subdist_en = df_tmp[['province_en','district_en', 'subdist_en']].values[0]
    
    prop['province_en'] = province_en
    prop['district_en'] = district_en
    prop['subdist_en'] = subdist_en
with open(os.path.join('..', 'data','breeding-sites','detection-en.geojson'), 'w') as FILE:
    json.dump(detection, FILE, indent=4, ensure_ascii=False, sort_keys=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17080994386527668, 'fraction_numerical': 0.002004811547714515, 'mean_word_length': 3.930830039525692, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '3273', 'license': 'MIT', 'n_tokens_mistral': 901, 'n_tokens_neox': 857, 'n_words': 122, 'path': 'src/preprocess/translator.ipynb', 'repo_name': 'pcrete/dengue_dash', 'size': '2494'}