Skip to content

Instantly share code, notes, and snippets.

@hashABCD
Created October 26, 2020 14:43
Show Gist options
  • Save hashABCD/3f9b639ca339ceab665f79f867dabc8c to your computer and use it in GitHub Desktop.
Save hashABCD/3f9b639ca339ceab665f79f867dabc8c to your computer and use it in GitHub Desktop.
preprocess covid data for flourish
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())
@hashABCD
Copy link
Author

preprocess gist for medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment