boston crime analysis¶

One main goal of any law enforcement department is stop crime. In the long term though, law enforcement should also prevent crime to help the city grow. To aid in the prevention of crime, law enforcement should analyze the arrests they make, the demographic of the people they arrest, the location, etc. This information is important because it can help point out unchecked bias or it can point out specific crimes that are particularly prevalant. part of growing as a city means analyzing the crime. Different crimes can indicate issues different issues with the community.

Purpose¶

The goal of this notebook is to generate a report containing different analysis of the recorded crimes in Boston and gather any trends about the location of the crimes.

Data Set¶

In [6]:
# depiction of the Boston Crimes Data Set as a DataFrame
import pandas as pd
df_crime = pd.read_csv('crime.csv', encoding='latin1')
df_crime
Out[6]:
INCIDENT_NUMBER OFFENSE_CODE OFFENSE_CODE_GROUP OFFENSE_DESCRIPTION DISTRICT REPORTING_AREA SHOOTING OCCURRED_ON_DATE YEAR MONTH DAY_OF_WEEK HOUR UCR_PART STREET Lat Long Location
0 I182070945 619 Larceny LARCENY ALL OTHERS D14 808 NaN 2018-09-02 13:00:00 2018 9 Sunday 13 Part One LINCOLN ST 42.357791 -71.139371 (42.35779134, -71.13937053)
1 I182070943 1402 Vandalism VANDALISM C11 347 NaN 2018-08-21 00:00:00 2018 8 Tuesday 0 Part Two HECLA ST 42.306821 -71.060300 (42.30682138, -71.06030035)
2 I182070941 3410 Towed TOWED MOTOR VEHICLE D4 151 NaN 2018-09-03 19:27:00 2018 9 Monday 19 Part Three CAZENOVE ST 42.346589 -71.072429 (42.34658879, -71.07242943)
3 I182070940 3114 Investigate Property INVESTIGATE PROPERTY D4 272 NaN 2018-09-03 21:16:00 2018 9 Monday 21 Part Three NEWCOMB ST 42.334182 -71.078664 (42.33418175, -71.07866441)
4 I182070938 3114 Investigate Property INVESTIGATE PROPERTY B3 421 NaN 2018-09-03 21:05:00 2018 9 Monday 21 Part Three DELHI ST 42.275365 -71.090361 (42.27536542, -71.09036101)
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
319068 I050310906-00 3125 Warrant Arrests WARRANT ARREST D4 285 NaN 2016-06-05 17:25:00 2016 6 Sunday 17 Part Three COVENTRY ST 42.336951 -71.085748 (42.33695098, -71.08574813)
319069 I030217815-08 111 Homicide MURDER, NON-NEGLIGIENT MANSLAUGHTER E18 520 NaN 2015-07-09 13:38:00 2015 7 Thursday 13 Part One RIVER ST 42.255926 -71.123172 (42.25592648, -71.12317207)
319070 I030217815-08 3125 Warrant Arrests WARRANT ARREST E18 520 NaN 2015-07-09 13:38:00 2015 7 Thursday 13 Part Three RIVER ST 42.255926 -71.123172 (42.25592648, -71.12317207)
319071 I010370257-00 3125 Warrant Arrests WARRANT ARREST E13 569 NaN 2016-05-31 19:35:00 2016 5 Tuesday 19 Part Three NEW WASHINGTON ST 42.302333 -71.111565 (42.30233307, -71.11156487)
319072 142052550 3125 Warrant Arrests WARRANT ARREST D4 903 NaN 2015-06-22 00:12:00 2015 6 Monday 0 Part Three WASHINGTON ST 42.333839 -71.080290 (42.33383935, -71.08029038)

319073 rows × 17 columns

In [20]:
# Data Dictionary for the Headings of the Boston Crime Data Set
crime_attributes ={'Incident Number': 'Numerical Identifier for this specific crime. It is unique for all crimes',
                    'Offense_Code': 'Numerical Identifier associated for the type of crime committed',
                    'Offense_Code_Group': 'Overall category of the crime committed',
                    'Offense_Description': 'The reason for the arrest',
                    'District': 'The police station affialiated with the report',
                    'Reporting_Area': 'Place where the arrest took place',
                    'Shooting': 'Whether or not the crime committed was a shooting crime',
                    'Occured on Date': 'Date and Time the arrest took place',
                    'Year': 'Year the arrest took place',
                    'Month': 'Month the arrest took place',
                    'Day of Week': 'Day of the week the crime took place',
                    'Hour': 'Hour the crime took place (1-23)',
                    'UCR_Part':'Uniform Crime Reporting Program Category',
                    'Street': 'Street in Boston the arrest took place',
                    'Lat': 'Latitude of where the arrest took place',
                    'Long': 'Longitude of where the arrest took place',
                    'Location': 'Latitude and Longitude Tuple of where the crime took place'}

df_offense_codes = pd.read_csv('offense_codes.csv', encoding='latin1') df_offense_codes

In [22]:
# Data Dictionary for the Heading for the Offense Code DataFrame
offense_code_attributes ={'Code': 'Numerical Identifier associated with a specific crime',
                             'Name': 'Name of the Crime'}

Creating a visual map of where the crimes take place and grouping different crimes by area will identify areas of Boston with higher crimes in general. Knowing this information will help law enforcement investigate crimes of those specific area in more detail to figure if there is actually more crime in that area or if there is another problem occuring. Second, clustering the arrests by crime will help Boston law enforcement decide what type of crime they need to work on preventing which is important for the overall decrease of crime in the city

For more Information¶

How does Law Enforcement Use Data Science

Using Data Science For Law Enforcement