As I continue to analyze the crime data for Denver, I have been looking at useful ways to visualize the data. Socrata is a great platform that is focused on delivering this data to the consumer.
There are a few websites that utilize the same crime data where you can see individual crimes pinpointed, or summary statistics benchmarked against national data.
Location-specific crime data, good drill down and comparisons:
![](https://elliottklug.com/wp-content/uploads/2019/02/Screen-Shot-2019-02-16-at-4.55.46-PM.png)
Zip code based, benchmarked against national crime rates:
![](https://elliottklug.com/wp-content/uploads/2019/02/Screen-Shot-2019-02-16-at-4.59.33-PM.png)
Neighborhood-based, details behind a paywall:
![](https://elliottklug.com/wp-content/uploads/2019/02/Screen-Shot-2019-02-16-at-5.02.07-PM-1.png)
Lots of visuals, sorted by crime type, yearly:
![](https://elliottklug.com/wp-content/uploads/2019/02/Screen-Shot-2019-02-16-at-5.22.39-PM.png)
Average monthly crime by neighborhood
My previous chart of daily crime was too granular for most uses, so I charted a rolling mean [window=3] of the monthly crime by neighborhood. While it may be an obvious outcome, the chart says that crime is higher in the summer. Eg, cold weather is a larger deterrent of crime than the police.
![](https://elliottklug.com/wp-content/uploads/2019/02/image.png)
Daily crime by neighborhood [Box Plot]
Leveraging the Plotly library again, I created a box blot of the daily crime for the five years of data made available.
max_index = list(df_neighborhood_month.max().sort_values(ascending=False).index)
trace_names = list(max_index)
traces = []
for trace in trace_names:
traces.append(go.Box(y=df_neighborhood[trace].values, name=trace))
data = traces
py.iplot(data)
Monthly crime by neighborhood [Box Plot]
The ease of the
trace_names = list(max_index)
traces = []
for trace in trace_names:
traces.append(go.Box(y=df_neighborhood_month[trace].values, name=trace))
data = traces
py.iplot(data)
Crime heatmap for the last 30 days
I scrubbed the data to exclude traffic tickets so that I could visualize where the crime was happening. I selected 30 days from the last update to create a snapshot of crime in Denver.
The HTML version of this map loads very slowly, so I am providing a picture of the results with a link. Next on the to-do-list is to host all of this data processing on a live python site, which should be much faster and more interactive.
![](https://elliottklug.com/wp-content/uploads/2019/02/map.png)
JupyterLab Notebook
All of the code work was done using Jupyter Labs notebook. You can find the file on my