Question
Right now I only have state , please tell me how modify my python program to input county and State with any case. US county
Right now I only have state, please tell me how modify my python program to input county and State with any case. US county data is under 'Admin2' in csv file
for example:
Enter State: (then press "Enter")Warren,New York
Enter State: (then press "Enter")warren,new york
output:Warren, New York 1062 confirmed Cases and 30 Deaths
Program:
import pandas as pd covid_data= pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/05-25-2022.csv') c_data = covid_data[covid_data['Country_Region']=='US'] c_data = c_data[['Province_State', 'Confirmed', 'Deaths', ]] result = c_data.sort_values(by='Confirmed', ascending=False) result = result.reset_index(drop=True)
top_10 = result.sort_values(by=['Deaths'], ascending=False).head(10)
# Users Enters State usstate_input = input('Enter State: (then press "Enter")')
# searches rows in dataset with the matching Province_State data = covid_data[covid_data['Province_State'] == usstate_input]
# searches for confirmed & deaths data conf_data = data.iloc[0]['Confirmed'] rip_data = data.iloc[0]['Deaths']
# output the results print(f'{usstate_input} {conf_data} confirmed Cases and {rip_data} Deaths')
i
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