Created
October 26, 2020 14:43
-
-
Save hashABCD/3f9b639ca339ceab665f79f867dabc8c to your computer and use it in GitHub Desktop.
preprocess covid data for flourish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_conf.drop(['Province/State','Lat', 'Long'],axis=1, inplace=True) | |
df_c=pd.DataFrame(columns=df_conf.columns) | |
df_c['Country/Region']=country_list | |
for col_name in df_c.keys()[1:]: | |
for ctry in country_list: | |
x=df_conf[col_name][df_conf["Country/Region"]==ctry].sum() | |
df_c[col_name][df_c['Country/Region']==ctry]=x | |
df_c['region']="" | |
df_c['Image']="" | |
for ctry in df_c['Country/Region'].unique(): | |
df_c['region'][df_c['Country/Region']==ctry]=str(fl_data.region[fl_data['Country Name']==ctry].sum()) | |
df_c['Image'][df_c['Country/Region']==ctry]=str(fl_data['Image URL'][fl_data['Country Name']==ctry].sum()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
preprocess gist for medium