Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV source path changed #13

Open
plix1014 opened this issue Apr 11, 2020 · 1 comment
Open

CSV source path changed #13

plix1014 opened this issue Apr 11, 2020 · 1 comment

Comments

@plix1014
Copy link

The path to the source data changed.
New Path: https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv

@plix1014
Copy link
Author

There is a 2nd change necessary for the US analysis.
US states are now in a seperated csv file. You need to read in this too.
df_us = pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv')

Below "US COVID-19 Analysis" In[8] read from df_us. Replace '/' by '_', remove additional columns from df_us.

uscases = df_us[df_us['Country_Region'] == 'US'].copy()

[...]

for index, row in uscases.iterrows():
location = row['Province_State']
try:
if ',' in location:
result = [x.strip() for x in location.split(',')]
statename = states[result[1]]
row['State'] = statename
uscases.loc[index, 'Province_State'] = statename
except:
print('Error parsing US state:', location)

uscases.drop(['UID', 'iso2', 'iso3', 'code3', 'FIPS', 'Admin2','Combined_Key'], axis=1, inplace=True)
usstatesummary = uscases.iloc[:,[0,-1]].groupby('Province_State').sum()
#[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant