Commit 8a41c323 by Dave Foote

fell very short on this one

parent 5f8fe9fe
Showing with 16 additions and 5 deletions
......@@ -33,7 +33,7 @@ def make_new_downloads(data_set_id, client, limit, offset):
def create_df(list_of_dicts):
#takes the full list of crime records and makes a df out of them
return pd.DataFrame(list_of_dicts)
'''
#get the data
id_17 = 'd62x-nvdr'
id_18 = '3i3m-jwuy'
......@@ -42,19 +42,30 @@ df_17 = create_df(get_full_dataset(id_17))
df_18 = create_df(get_full_dataset(id_18))
#summary statistics:
print("Part 1: Statistical Summary")
print('10 Most Common Chicago Crimes in 2017:\n',
df_17.primary_type.value_counts().head(10))
print('10 Most Common Chicago Crimes in 2018:\n',
df_18.primary_type.value_counts().head(10))
print('10 Neighborhoods with Highest Volume of Crime in 2017:\n',
print('10 Neighborhoods with Highest Volume of Crime in 2017:\n',
df_17.community_area.value_counts().head(10))
print('10 Neighborhoods with Highest Volume of Crime in 2018:\n',
print('10 Neighborhoods with Highest Volume of Crime in 2018:\n',
df_18.community_area.value_counts().head(10))
arrest_rates_17 = df_17.arrest.value_counts()
arrest_rates_18 = df_18.arrest.value_counts()
aps_17 = arrest_rates_17[1] / arrest_rates_17[0]
aps_18 = arrest_rates_18[1] / arrest_rates_18[0]
print('Arrests Per Stop in 2017:\n', (arrest_rates_17[1] / arrest_rates_17[0]))
print('Arrests Per Stop in 2018:\n', (arrest_rates_18[1] / arrest_rates_18[0]))
print('Arrests Per Stop in 2017:\n', aps_17)
print('Arrests Per Stop in 2018:\n', aps_18)
print('Change in Arrest Per Stop Rate from 17-18:\n', (aps_18 - aps_17))
#pull in census tract data from chicago data portal:
id_tract = '74p9-q2aq'
df_tract_info = create_df(get_full_datset(id_tract))
#update 17 and 18 dfs with tracts
df_17.tract = df_17.location.apply()
'''
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment