Seaborn makes the task of visualizing the distribution of a dataset much easier. Starting with the population data as discussed before, let's see how it distributes among different countries in 2017 by plotting a bar plot:
import seaborn as sns
import matplotlib.pyplot as plt
# Extract USA population data in 2017
current_population = population_df[(population_df.Location
== 'United States of America') &
(population_df.Time == 2017) &
(population_df.Sex != 'Both')]
# Population Bar chart
sns.barplot(x="AgeGrp",y="Value", hue="Sex", data = current_population)
# Use Matplotlib functions to label axes rotate tick labels
ax = plt.gca()
ax.set(xlabel="Age Group", ylabel="Population...