Created
August 2, 2020 11:22
-
-
Save SaraM92/854e2f989eae83b2d58efa1817790ea2 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
#Import needed libraries | |
import pygal | |
import pandas as pd | |
#Parse the dataframe | |
data = pd.read_csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv") | |
#Get the mean number of cases per states | |
mean_per_state = data.groupby('state')['cases'].mean() | |
#Draw the bar chart | |
barChart = pygal.Bar(height=400) | |
[barChart.add(x[0], x[1]) for x in mean_per_state.items()] | |
display(HTML(base_html.format(rendered_chart=barChart.render(is_unicode=True)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment