Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Red Light Violations in the City of Chicago. For this project we want to extract the date and the corresponding number of red light violations
Red Light Violations in the City of Chicago. For this project we want to extract the date and the corresponding number of red light violations in the City of Chicago and do a linear regression on the data, using NumPy. The data is contained in the 50.2 MB file Red_Light_Camera_Violations.csv, obtained from the City of Chicago's Data Portal (https://data.cityofchicago.org/). This file contains data from July 1, 2014 to the present, minus two weeks. Include the entire range of dates in your analysis. Your analysis should solve the follwing two problems: (Problem 1) Extract the number of violations for each month of the year. Denote the months of the year numerically. That is, let 1 stand for January, 2 for February, ..., and 12 for December. Create two NumPy arrays for the months (X) and the number of red light violations (Y). Write a generic linear function ax+b and then fit the data to that function, using the appropriate NumPy functon. Your final report for Problem 1 should include the code you used and a plot of the data, as points, and the graph of the fitted function, all in one single plot. For plotting, you should use MatPlotLib but you can also use any other Python-related plotting tool. (Problem 2) Extract the number of violations for each day of the week. Denote the days of the week numerically. That is, let 1 stand for Monday, 2 for Tuesday, ..., and 7 for Sunday. Create two NumPy arrays for the days (X) and the number of red light violations (Y). Fit the data with a degree 7 polynomial, using the appropriate NumPy functon. Your final report for Problem 2should include the code you used and a plot of the data, as points, and the graph of the fitted function, all in one single plot. For plotting, you should use MatPlotLib but you can also use any other Python-related plotting tool.
https://1drv.ms/u/s!An8sv1t-dz8vhRMF1bYUbLuBwpT1 (link to the Data file).
*download the file for best usage, and give explanations please on how you do this.
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