Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions