Definitions
'Beat' - "The City of Atlanta is divided into six unique geographic areas – known as Zones – for the purposes of allocating APD resources. Each Zone is then divided into 13-14 “beats” assigned to a specific officer for patrol purposes.".
'UCR' - Uniform Crime Reporting Number. This number classifies a crime using a number system. Links to chart attached.
'IBR' - Allows for more specific crime types.
'NPU' - "The City of Atlanta is divided into twenty-five (25) Neighborhood Planning Units (NPUs), which are citizen advisory councils that make recommendations to the Mayor and City Council on zoning, land use, and other planning-related matters. ".
Research
Atlanta Police Beat and Zones
NIBRS
UCR CLASSIFICATION ABBREVIATIONS
Atlanta Police Department Crime Data Downloads
Uniform Crime Reporting Handbook
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from scipy import stats
import plotly.express as px
from datetime import datetime
from geopy.geocoders import Nominatim
import geopy as gp
atlanta = pd.read_csv("COBRA-2009-2019 (Updated 1_9_2020)/COBRA-2009-2019.csv")
atlanta.head()
print(atlanta.describe(), '\n\n\n')
atlanta.info()
#DROP COLUMNS
atlanta = atlanta.drop(columns=['Apartment Office Prefix', 'Apartment Number', 'Location', 'Location Type'])
# For converting code to crime group
def codes_to_crimes(value):
if value > 100 and value < 199:
return 'Homicide'
elif value > 200 and value < 299:
return 'Rape'
elif value > 300 and value < 399:
return 'Robbery'
elif value > 400 and value < 499:
return 'Assault'
elif value > 500 and value < 599:
return 'Burglary'
elif value > 600 and value < 699:
return 'Larceny'
elif value > 700 and value < 799:
return 'Motor_theft'
elif value > 800 and value < 899:
return 'Arson'
atlanta['Crime'] = pd.Series(atlanta['UCR #']).apply(codes_to_crimes).astype('str')
atlanta.head()
# *****************************
# HIGHLY IMPORTANT while testing
# *****************************
# Sample data
# print("Original Data Stats: \n")
# print(atlanta.describe())
# print('\n--------\n')
# atlanta = atlanta.sample(frac=0.01) # 1% sample set
# print(atlanta.describe())
sns.heatmap(atlanta.corr())
Conclusions
Most can be ignored, but the 'Beat' vs 'UCR #' is interesting. It is not a high correlation but one is there. It does show that there is at least some relation between the Zone of town lived in and the type of crime committed.
sns.pairplot(atlanta)
plt.show()
Conclusions
.....
fig = px.pie(atlanta, values='UCR #', names='Crime', title='Crimes in Atlanta', color_discrete_sequence=px.colors.sequential.RdBu)
fig.show()
Conclusions
No arsons or rapes were reported! Not sure if this is due to gaps in the data reporting...
fig = px.histogram(atlanta, x="Neighborhood", title='Crime by Neighborhood')
fig.show()
Conclusions
The neighborhoods with the largest crime rates are Midtown, Downtown, and Old Fourth Ward.
BBox = ((atlanta.Longitude.min(), atlanta.Longitude.max(),atlanta.Latitude.min(), atlanta.Latitude.max()))
BBox
img = plt.imread('map.png')
fig, ax = plt.subplots(figsize = (15,12))
ax.scatter(atlanta.Longitude, atlanta.Latitude, zorder=1, alpha= .1,c='b', s=10)
ax.set_title('Plotting Crime Map')
ax.set_xlim(BBox[0],BBox[1])
ax.set_ylim(BBox[2],BBox[3])
ax.imshow(img, zorder=0, extent = BBox, aspect= 'equal')
Conclusions
There is more crime the closer to the city you are. Also there seems to be less crime around the airport.