Last active
March 6, 2020 14:52
-
-
Save mashhadazam/36f5e9e809799998fb86ffc461e199dd to your computer and use it in GitHub Desktop.
This file contains 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
### Melt the dateframe into the right shape and set index | |
def cleandata(df_raw): | |
df_cleaned=df_raw.melt(id_vars=['Province/State','Country/Region','Lat','Long'],value_name='Cases',var_name='Date') | |
df_cleaned=df_cleaned.set_index(['Country/Region','Province/State','Date']) | |
return df_cleaned | |
# Clean all datasets | |
ConfirmedCases=cleandata(ConfirmedCases_raw) | |
Deaths=cleandata(Deaths_raw) | |
Recoveries=cleandata(Recoveries_raw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment