Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a CSV file from the NY Times COVID - 1 9 Data Tracking project, read the contents of the colleges file then locate the

Given a CSV file from the NY Times COVID-19 Data Tracking project, read the contents of the colleges file then locate the information regarding the number of reported cases at for the schools in the specified state and county.
Update the function process_by_county(state, county) for the following:
Import the CSV module and read the file colleges.csv
Loop and process the data from the file for the following:
Use the state and county columns to filter the needed schools.
Store the date column in a variable so you can adjust the formatting to be MM/DD/YYYY.
Use the cases and cases_2021 column as the value add together the total number of cases for 2020 and 2021.
If the school is from the selected state and county, output the sentence from one of the following example sentences based on the available data as a single string:
Cases only in 2020: As of MM/DD/YYYY, COLLEGE NAME reported YY cases of COVID-19 in 2020.
Cases only in 2021: As of MM/DD/YYYY, COLLEGE NAME reported YY cases of COVID-19 in 2021.
Cases in 2020 & 2021: As of MM/DD/YYYY, COLLEGE NAME reported YY cases of COVID-19 in 2020 and 2021.
No Cases Reported: As of MM/DD/YYYY, COLLEGE NAME reported no cases of COVID-19 in 2020 or 2021.
Test in your terminal using command line arguments to ensure the program passes the provided test cases found in the TESTS.md file.
Tips
Function process_by_county() does not return any values, it only prints the resulting sentence one school at a time.
Data may or may not be present in the cases and cases_2021 columns, use appropriate exception handling before adding.
The sentence in the print() statement should be a single string statement, no commas separating values.
Some values in the CSV may be modified from the original to ensure you are correctly parsing the data as requested.
Some counties have the same name in multiple states so it is important to filter by state and county.
You may want to research how to use the csv.DictReader() method to make things easier.
You may view the provided expected test result JSON file, but using it in your program code will result in zero points being awarded.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago