Search⌘ K
AI Features

Solution: Plotting

Explore ways to visualize DataFrame data using bar charts, stacked bars, and histograms with pandas. Learn to plot Lifespan and Speed metrics as well as age distributions, and save your visualizations as image files for easy display and sharing.

Solution 1

Given the following DataFrame df:

Snail Cat Dog Elephant Rabbit Horse Cheetah
Lifespan 2 12 10 50 9 25 10
Speed 0.1 45 45 40 50 55 100

a) Create a bar plot of the entire DataFrame, showing both Lifespan and Speed for each animal.

b) Create a stacked bar plot of the same DataFrame. ...