Back in January, a prominent American politician asserted over Twitter that Georgia’s 5th Congressional district is “in horrible shape and falling apart (not to mention crime infested.)” As a recent resident of Georgia’s 5th, this did not sound like an accurate assessment of the area, so I decided to take a closer look at my neighborhood’s crime data.

Using raw data from the Atlanta Police Department’s data site, I downloaded information on every reported crime in Midtown Atlanta from January 2009 through February 2017. To organize the data, I needed to change the report date column to a datetime object, then reindex the dataset. That way I can assess whether crime has gotten better or worse over the past 8 years.

data['Date']=pd.to_datetime(data['Report Date']) data.set_index('Date',inplace=True) data['Year']=data.index.year data['Month']=data.index.month data.sort_index(inplace=True)

LARCENY-FROM VEHICLE 7152 LARCENY-NON VEHICLE 3202 AUTO THEFT 1307 ROBBERY-PEDESTRIAN 608 BURGLARY-RESIDENCE 496 AGG ASSAULT 442 BURGLARY-NONRES 375 ROBBERY-COMMERCIAL 72 ROBBERY-RESIDENCE 40 RAPE 28 HOMICIDE 10

These represent the total number of crimes in each category since 2009. But let’s get a closer look at crime rates over time. The cell below will show the total number of crimes by month.

cc0=pd.DataFrame(data.index.value_counts()).resample('M').sum() cc0.plot(figsize=(18,6), color='orange')

The Y axis represents total number of crimes per month, and the X axis represents a given month. It looks like crime is generally decreasing, but perhaps a rolling average will give a clearer picture of whether crime is truly decreasing or not.

cc0.rolling(window=12,center=True).mean().plot(figsize=(18,6),color='orange')

(Scroll right to see the remaining code)

By taking a rolling average, we can see overall monthly crime in general is down dramatically over the past 8 years in Midtown. By far, the most common theft in the dataset was larceny from vehicle. In the unofficial capital of “why walk when I can drive?,” this makes sense. Let’s take a closer look and see if there has been a change in this particular type of crime.

cc10=pd.DataFrame(data[data.Crime=='LARCENY-FROM VEHICLE'].index.value_counts()).resample('M').sum() cc10.plot(figsize=(18,6),color='orange')

(Scroll right to see the remaining code)



Looks like less to me, but let’s check with the moving average

cc10.rolling(window=12,center=True).mean().plot(figsize=(18,6),color='orange')

(Scroll right to see the remaining code)

So there’s less overall crime in Midtown in 2017 than in 2009, and fewer things stolen from cars. What about when the cars themselves are stolen, the third most common crime in the dataset?

cc20=pd.DataFrame(data[data.Crime=='AUTO THEFT'].index.value_counts()).resample('M').sum()

(Scroll right to see the remaining code)

cc20.rolling(window=12,center=True).mean().plot(figsize=(18,6), color='orange')

(Scroll right to see the remaining code)

Well, it looks like overall crime is down, thefts from cars are down, and theft of cars is down. While we may see different results if we focus on the city or district as a whole or on other categories, it looks like my small corner of Georgia’s 5th is doing alright when it comes to crime.

Alexander Bryant

Connect with Me:

LinkedIn and GitHub

Data Sources:

Atlanta Police Department

Header Image Credit:

Google Maps