<jupyter_start><jupyter_text>Geocodio tells you the likely accuracy of the lat/long it's provided with an accuracy score. Some of the scores do not have high accuracy scores, which is worth mentioning. For now, we'll see if any mapping errors actually occur. If they do, I'll go back and engineer a solution.<jupyter_code>#We have 239 cities, so we want to make sure there's 239 rows. 
df.shape<jupyter_output><empty_output><jupyter_text>Because I'm only missing five values, I'm going to manually find their lat/lon coordinates and then add them in. I'll do this here because I want them mapped in all future data.<jupyter_code># Manual updating of relevent values 

new_data = [(40.0874759, -108.8048292, 'CO3', 'CO'), (39.446649, -106.03757, 'CO2', 'CO'), 
            (28.022243, -81.732857, 'FL9', 'FL'), (39.9689532, -82.9376804, 'OH3', 'OH'), 
            (39.103119, -84.512016, 'OH1', 'OH')]

indexes = (63, 85, 98, 172, 191)

for i in range(5): 
    df.loc[indexes[i],'Latitude'] = new_data[i][0]
    df.loc[indexes[i], 'Longitude'] = new_data[i][1]
    df.loc[indexes[i], 'Congressional District'] = new_data[i][2]
    df.loc[indexes[i], 'State.1'] = new_data[i][3]

# Checking to see we've fixed all lat/lon problems 

df.loc[df['Latitude'] == 0]
# Dropping unnecessary columns added by Geocodio for the sake of data tidiness 

df = df.drop(columns = ['Number', 'Street', 'City.1', 'Source'])
df.head(1)<jupyter_output><empty_output><jupyter_text>Much better. The campaign wants to keep track of the status of the anti-panhandling statutes/ordinances in each city, and they want to be able to update those values to reflect varying degrees of success as the campaign goes on. I'm going to create a 'status' value for each city set it's default to "active." Then I'm going to map "status text" and "marker color" right onto the values.<jupyter_code># Adding in a "status" column

df['status'] = 0


# Creating a conditional column explaining ordinance status

d_text = {0: 'Ordinance Active - With No Response', 
          1: 'Ordinance Active - With Response Indicating No Immediate Repeal',
          2: 'Ordinance Active - With Committment To Review', 
          3: 'Ordinance Halted - With Committment to Review',
          4: 'Ordinance Repealed'}

df['statusText'] = df['status'].map(d_text)

# Setting point color conditionally based upon status 

d_color = {0: 'rgb(255, 0, 0)',
           1: 'rgb(255, 192, 203)',
           2: 'rgb(255, 165, 0)', 
           3: 'rgb(255, 255, 0)', 
           4: 'rgb(127, 255, 0)'}

df['color'] = df['status'].map(d_color)
# print(df.dtypes)
df.head(3)<jupyter_output><empty_output><jupyter_text>Now I'm going to persist my changes. I'll make updates periodically, but I'll use a seperate notebook for that so that I don't have to continously repeat this project.<jupyter_code>df.to_csv('cleaned_data.csv', mode ='w+')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12672176308539945, 'fraction_numerical': 0.05647382920110193, 'mean_word_length': 4.060975609756097, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '668464', 'license': 'Apache-2.0', 'n_tokens_mistral': 1099, 'n_tokens_neox': 949, 'n_words': 348, 'path': 'EDA.ipynb', 'repo_name': 'mattymecks/nlchp-mapping-project', 'size': '2904'}