Skip to content

Instantly share code, notes, and snippets.

@rohitrajiit
Created June 2, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohitrajiit/7549be816c42fd989a011f6083011123 to your computer and use it in GitHub Desktop.
Save rohitrajiit/7549be816c42fd989a011f6083011123 to your computer and use it in GitHub Desktop.
monthwise = df.groupby(['district','month']).last()['confirmed'].unstack()
monthwise['growth'] = monthwise[5]/monthwise[4]
growth = monthwise.drop(6, axis=1)[monthwise[5]>1000].dropna(subset=['growth'])
growth = growth.sort_values(by=['growth'], ascending = False)
growth.rename(columns ={4: 'Last day of April', 5: 'Last day of May'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment