Graphing Charts in Python
Python Charts
Rather than plotting the charts side by side for 2010 vs 2020, we can plot the 2010 and 2020 data for each state on top of each other:
import pandas as pd
df = pd.read_excel('us_population_change_2020.xlsx')
ax = df.plot.bar(x="State", y=["Population 2020", "Population 2010"], stacked=True)
Explanation:
Now, we’ve added the “stacked = True” parameter into the graphing function. This is another simple way of specifying how we want the charts displayed.