Skip to content

Instantly share code, notes, and snippets.

@kurasaiteja
Last active March 21, 2021 12:29
Show Gist options
  • Save kurasaiteja/bac178b77b15da8a420c5c35d712d5c9 to your computer and use it in GitHub Desktop.
Save kurasaiteja/bac178b77b15da8a420c5c35d712d5c9 to your computer and use it in GitHub Desktop.
#We will create an aggregated dataset by aggreagting the required columns using previous function.
summary_cols = ['people_vaccinated',
'people_vaccinated_per_hundred',
'people_fully_vaccinated',
'people_fully_vaccinated_per_hundred',
'total_vaccinations_per_hundred',
'total_vaccinations']
summary = summary_df.set_index("country")
vaccines = vaccine_df[['country', 'vaccines']].drop_duplicates().set_index('country')
summary = summary.join(vaccines)
for col in summary_cols:
summary = summary.join(aggregate(vaccine_df, col))
#Two aditional columns for better understanding
summary['percentage_vaccinated'] = summary.people_vaccinated / summary.population * 100
summary['tested_positive'] = summary.total_confirmed / summary.total_tests * 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment