Answered step by step
Verified Expert Solution
Question
1 Approved Answer
offence_codes.csv: Is a CSV file that contains offence codes and information about each code crime.csv: Is a CSV file containing information about 455872 crimes reported
offence_codes.csv: Is a CSV file that contains offence codes and information about each code
crime.csv: Is a CSV file containing information about 455872 crimes reported in Denver, mostly occurring in 2018.
- Write a function code_to_names(code) that takes an int crime code and returns a list of strings where each string contains the code extension and the full name of the crime.
- Write a function code_from_keywords(keywords) that an a list of strings and returns a list of all the crime codes that include all the keywords in their description
- Write a function crimes_by_code(code) that returns a list of all the crimes with the given code that have occurred. Each element of the return list is a tuple having he crime id, the abbreviated crime name, the date and time, and neighbourhood id of the crime. See the sample output for an example.
- Write a function crimes_by_code_extension(code, extension) that returns a list of all the crimes with the given code and extension that have occurred.
Here is the first few rows in text of the crime.csv file for testing:
INCIDENT_ID | OFFENSE_ID | OFFENSE_CODE | OFFENSE_CODE_EXTENSION | OFFENSE_TYPE_ID | OFFENSE_CATEGORY_ID | FIRST_OCCURRENCE_DATE | LAST_OCCURRENCE_DATE | REPORTED_DATE | INCIDENT_ADDRESS | GEO_X | GEO_Y | GEO_LON | GEO_LAT | DISTRICT_ID | PRECINCT_ID | NEIGHBORHOOD_ID | IS_CRIME | IS_TRAFFIC |
2.02E+09 | 2.02E+15 | 5213 | 0 | weapon-unlawful-discharge-of | all-other-crimes | 6/15/2016 11:31:00 PM | 6/15/2016 11:31:00 PM | 3193983 | 1707251 | -104.81 | 39.77319 | 5 | 521 | montbello | 1 | 0 | ||
2.02E+10 | 2.02E+16 | 2399 | 0 | theft-other | larceny | 10/11/2017 12:30:00 PM | 10/11/2017 4:55:00 PM | 1/29/2018 5:53:00 PM | 3201943 | 1711852 | -104.781 | 39.78565 | 5 | 522 | gateway-green-valley-ranch | 1 | 0 | |
2.02E+10 | 2.02E+16 | 2305 | 0 | theft-items-from-vehicle | theft-from-motor-vehicle | 3/4/2016 8:00:00 PM | 4/25/2016 8:00:00 AM | 4/26/2016 9:02:00 PM | 2932 S JOSEPHINE ST | 3152762 | 1667011 | -104.957 | 39.66349 | 3 | 314 | wellshire | 1 | 0 |
Here is the first few rows in text of the offense_codes.csv file for testing:
OFFENSE_CODE | OFFENSE_CODE_EXTENSION | OFFENSE_TYPE_ID | OFFENSE_TYPE_NAME | OFFENSE_CATEGORY_ID | OFFENSE_CATEGORY_NAME | IS_CRIME | IS_TRAFFIC |
2804 | 1 | stolen-property-possession | Possession of stolen property | all-other-crimes | All Other Crimes | 1 | 0 |
2804 | 2 | fraud-possess-financial-device | Possession of a financial device | all-other-crimes | All Other Crimes | 1 | 0 |
2901 | 0 | damaged-prop-bus | Damaged business property | public-disorder | Public Disorder | 1 | 0 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started