<jupyter_start><jupyter_text>Output<jupyter_code>CS.to_csv('..\Transformed\Closest_Firestation')
## Verification 

# manual validation that the STATION_ID  that was selected for each experiment is the correct distance away
NFIR = NFIR.merge(CS, how= 'left', left_on='ID',right_on='ID')
test = NFIR.merge(STATION[['ID','X','Y']],how= 'left',left_on= 'CLOSEST_STATION_ID',right_on='ID' )

Calculated = haversine(test['X_x'],test['Y_x'],test['X_y'],test['Y_y'])
sum(Calculated - NFIR['CLOSEST_STATION_MILES'].values) < 1e-10


# TO-DO
#1. discriptive statistics by state/county/tract. Mean dist, avg dist, max dist
#2. replicate this methodology to Find tracts that are far away from fire stations
#3.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15247252747252749, 'fraction_numerical': 0.008241758241758242, 'mean_word_length': 7.010989010989011, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '244317', 'license': 'MIT', 'n_tokens_mistral': 278, 'n_tokens_neox': 264, 'n_words': 59, 'path': 'Code/Munging/NFIRS/Distance_to_Nearest_Fire_Station.ipynb', 'repo_name': 'LaurenHa/rcp2', 'size': '728'}