Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code a Python script that accomplishes the following -- Reads nics-firearm-background-checks.csv (https://drive.google.com/file/d/17B5ZrAakOQoeeuyJxzqUza0e-hQthY1f/view?usp=sharing) into a DataFrame called 'raw_frame.' From 'raw_frame,' extracts and transforms the data shown
Code a Python script that accomplishes the following --
- Reads nics-firearm-background-checks.csv (https://drive.google.com/file/d/17B5ZrAakOQoeeuyJxzqUza0e-hQthY1f/view?usp=sharing) into a DataFrame called 'raw_frame.'
- From 'raw_frame,' extracts and transforms the data shown below in columns A, B, E, and F, into a second DataFrame called 'transformed_frame.' The cells of 'transformed_frame' will need to contain permit application totals for state-year combinations, in separate columns for handgun permit applications and long gun permit applications, and in separate columns for each year in the range 2010-2020. Note that months will need to be aggregated into years. As a result of this and due to moving years from rows into columns, the total number of rows will shrink from more than 14,000 to fewer than 60.
- Converts 'transformed_frame' into a saved .csv file called transformed_frame_csv.csv. The column headings of this .csv file will need to be as shown in the second diagram below. You will submit this file together with the rest of your work.
The original nics-firearm-background-checks.csv file
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