Question: program in python don't import csv Program in python Part II: Build a Dictionary that Maps a State's Name to Infection Data (20 points) Complete
program in python
don't import csv

Program in python Part II: Build a Dictionary that Maps a State's Name to Infection Data (20 points) Complete the function build_dict_stats_by_state (), which takes two arguments: . filename: the name of a CSV file of COVID-19 data . stat: the data value we want to associate with each state. Valid values are "cases", "deaths", "recovered" and "active", which may appear in any case. For example, "Cases", "CASES", "caSES", etc. would all be valid. The function opens the CSV file and processes it to build a dictionary that maps each state's name to its total of all stat values in that state's regions. For example, build_dict_stats_by_state (' 03-22-2020.csy', 'Cases' ) would build a dictionary that maps each state's name to the total of the ' cases' column for that state. For example, for the file ' 03-22-2020. cav' and stats = ' cases', the returned dictionary is given below: ['New York' : 15800, 'Washington': 1997, 'New Jersey' : 1914, 'California' : 1646, 'Illinois': 1049, 'Michigan' : 1035, 'Florida' : 1004, 'Louisiana' : 837, 'Massachusetts' : 646, 'Texas' : 643, 'Georgia': 621, 'Colorado': 591, 'Pennsylvania': 509, 'Tennessee' : 505, 'Wisconsin': 381, 'Ohio' : 356, 'Connecticut' : 327, 'North Carolina' : 305, 'Maryland': 244, 'Virginia' : 220, . . . etc . . . }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
