aatishb / covid

Tracking Coronavirus Growth
156 stars 42 forks source link

CSV source path changed #13

Open plix1014 opened 4 years ago

plix1014 commented 4 years ago

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 commented 4 years ago

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 dfus. 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()

[...]