crime predict¶

It does not matter the city, state, or country you live in - crime occurs everywhere. In fact, in just the city of Boston alone, there were over 73,000 crime incidents that the Bolice Police had to respond to in 2022. 73,000! That's approximately 200 incidents PER DAY! According to another source, city-data.com, Boston crime was higher than that of 78.3% of other major US cities. Do these staggering number not raise a primary concern for all residents in the city?

https://data.boston.gov/dataset/crime-incident-reports-august-2015-to-date-source-new-system/resource/313e56df-6d77-49d2-9c49-ee411f10cf58

https://www.city-data.com/crime/crime-Boston-Massachusetts.html

In [1]:
import pandas as pd

pd.read_csv('crime.csv')
C:\Users\spenc\AppData\Local\Temp\ipykernel_7372\904721680.py:3: DtypeWarning: Columns (0) have mixed types. Specify dtype option on import or set low_memory=False.
  pd.read_csv('crime.csv')
Out[1]:
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 222076257 619 NaN LARCENY ALL OTHERS D4 167 0 2022-01-01 00:00:00 2022 1 Saturday 0 NaN HARRISON AVE 42.339542 -71.069409 (42.33954198983014, -71.06940876967543)
1 222053099 2670 NaN HARASSMENT/ CRIMINAL HARASSMENT A7 0 2022-01-01 00:00:00 2022 1 Saturday 0 NaN BENNINGTON ST 42.377246 -71.032597 (42.37724638479816, -71.0325970804128)
2 222039411 3201 NaN PROPERTY - LOST/ MISSING D14 778 0 2022-01-01 00:00:00 2022 1 Saturday 0 NaN WASHINGTON ST 42.349056 -71.150498 (42.34905600030506, -71.15049849975023)
3 222011090 3201 NaN PROPERTY - LOST/ MISSING B3 465 0 2022-01-01 00:00:00 2022 1 Saturday 0 NaN BLUE HILL AVE 42.284826 -71.091374 (42.28482576580488, -71.09137368938802)
4 222062685 3201 NaN PROPERTY - LOST/ MISSING B3 465 0 2022-01-01 00:00:00 2022 1 Saturday 0 NaN BLUE HILL AVE 42.284826 -71.091374 (42.28482576580488, -71.09137368938802)
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
73847 232000091 1402 NaN VANDALISM A1 66 0 2022-12-31 23:30:00 2022 12 Saturday 23 NaN CHARLES ST 42.359790 -71.070782 (42.35979037458775, -71.07078234449541)
73848 232000002 3831 NaN M/V - LEAVING SCENE - PROPERTY DAMAGE C11 0 2022-12-31 23:37:00 2022 12 Saturday 23 NaN COLUMBIA RD 42.319593 -71.062607 (42.31959298334654, -71.06260699634272)
73849 232000140 619 NaN LARCENY ALL OTHERS D14 778 0 2022-12-31 23:45:00 2022 12 Saturday 23 NaN WASHINGTON ST 42.349056 -71.150498 (42.34905600030506, -71.15049849975023)
73850 232000315 3201 NaN PROPERTY - LOST/ MISSING D4 167 0 2022-12-31 23:50:00 2022 12 Saturday 23 NaN HARRISON AVENUE NaN NaN NaN
73851 232000052 3114 NaN INVESTIGATE PROPERTY A1 0 2022-12-31 23:50:00 2022 12 Saturday 23 NaN MOUNT VERNON ST 42.357879 -71.069680 (42.357878706878985, -71.06967973039733)

73852 rows × 17 columns

In [2]:
pd.read_csv('description.csv')
Out[2]:
Field Name Description
0 [incident_num] Internal BPD report number
1 [offense_code] Numerical code of offense description
2 [Offense_Code_Group_Description] Internal categorization of [offense_description]
3 [Offense_Description] Primary descriptor of incident
4 [district] What district the crime was reported in
5 [reporting_area] RA number associated with the where the crime ...
6 [shooting] Indicated a shooting took place.
7 [occurred_on] Earliest date and time the incident could have...
8 [UCR_Part] Universal Crime Reporting Part number (1,2, 3)
9 [street] Street name the incident took place

Using latitude and longitude coordinates, I will plot the locations of all crimes and determine whether location has a play in overall Boston crime. Additionally, I will use the crime occurrance date to determine whether the time of day also has an impact. Lastly, using offense codes and desciptions will paint a picture as to how severe crimes are (different color coordinates on plot graph). Doing so allows me to discover whether location, time of day, and types of crimes has an effect overall crime in Boston and further inform local residents about how to stay safe in the city.