Question: The Task: The full file can be found on Kaggle : https://www.kaggle.com/AnalyzeBoston/crimes-in-boston The file is called crime.csv and it opens up in Excel Your job

The Task:

The full file can be found on Kaggle : https://www.kaggle.com/AnalyzeBoston/crimes-in-boston

The file is called crime.csv and it opens up in Excel

Your job is to code a Python 3 program that uses the provided file and answers the following questions.

1. How many crimes were reported in the year 2015?

2. How many incidents involving shootings were reported in the year 2018?

3. How many "larceny" incidents occurred in 2017?

4. How many "drug violation" incidents occurred in all Districts "A" and "B" combined?

5. Which were the three most common offense codes in 2016 (sorted in descending order of the number of offenses)?

6. Which two years had the most robberies (sorted in descending order of the number of robberies)?

7. List the top three non-null street names in terms of the number of incidents reported (in descending order of the number of incidents reported, and then alphabetically if need be).

8. List the offense code groups of the three most common offense codes that occur on Fridays, Saturdays and Sundays combined in districts A, C and E combined (sorted in descending order of the number of offenses).

Format and Submission Your main Python file must be called mainfile.py. Your program should be able to take in exactly one command-line parameter (described below) and print out output depending on that parameter. The parameter specifies either the question number or student number (see the examples below). Below, I've provided you with exactly the output that your program should produce given the data set you've been given and given the input parameter specified. Note that the first test case below prints out a student number of 1234567. It is critical that this works. Also make sure the code is commented for understanding.

There needs to be an output like the one given below. Make sure you make a new column for the year. The format for the date is dd/m/yyyy.

The structure of the file i.e. you need to know the ordering of the columns. So you need to filter out records by date, you would need to know the date column number in the file, and then use that info to do the filtering of records. Make sure to include a column of the headings in your code. The datetime in the OCCURRED_ON_DATE column needs to be filtered so that the questions can be answered. Make a YEAR MONTH and DAY column using python code and not manually changing the excel sheet(crime.csv). It must be able to run on windows 10 in the cmd. You can use pandas or OOP when coding.

> python mainfile.py studentnumber

1234567

> python mainfile.py 1

12219

> python mainfile.py 2

39

> python mainfile.py 3

2442

> python mainfile.py 4

1554

> python mainfile.py 5

3115

3006

3831

> python mainfile.py 6

2016

2017

> python mainfile.py 7

WASHINGTON ST

BLUE HILL AVE

BOYLSTON ST

> python mainfile.py 8

Medical Assistance

Motor Vehicle Accident Response

Investigate Person

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!