From the course: Data Analysis with Python and Pandas
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Grouped and stacked bar charts
From the course: Data Analysis with Python and Pandas
Grouped and stacked bar charts
- [Instructor] Okay, so we just saw an example of creating a bar chart out of a single series. A lot of the times that's all we want to do. We have a single metric of interest and we just want to plot how well did each category do in this metric of interest. If we plot multiple series with a bar chart, we'll create a grouped bar chart. So here we have a data frame that has our store number as the index, and our columns are our product categories. If we call a bar plot on this data, we'll end up with a grouped bar chart where our rows are going to be our X-axis, so we can see the total sales by product category for each of our stores. What do we learn from this chart here? Well, we learned that our biggest selling category is grocery across all stores. We also learned that store three tends to do the best across all categories, et cetera. And so these bars are going to be grouped by our data frame index. So when you're, you know, pivoting your table before building a chart, just think…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
The Matplotlib API and the plot() method9m 33s
-
(Locked)
Challenge: Basic line chart49s
-
(Locked)
Solution: Basic line chart3m 1s
-
(Locked)
Chart titles3m 26s
-
(Locked)
Chart colors5m 13s
-
(Locked)
Line styles2m 1s
-
(Locked)
Chart legends and gridlines3m 51s
-
(Locked)
Chart styles4m 8s
-
(Locked)
Challenge: Stylized line chart1m 11s
-
(Locked)
Solution: Stylized line chart1m 21s
-
(Locked)
Subplots and figure size5m 28s
-
(Locked)
Challenge: Subplots1m 33s
-
(Locked)
Solution: Subplots2m 59s
-
(Locked)
Bar charts6m 13s
-
(Locked)
Grouped and stacked bar charts5m 9s
-
(Locked)
Challenge: Bar charts1m 11s
-
(Locked)
Solution: Bar charts2m 19s
-
(Locked)
Pie charts and scatterplots6m 52s
-
(Locked)
Challenge: Scatterplots1m
-
(Locked)
Solution: Scatterplots2m 10s
-
(Locked)
Histograms3m 46s
-
(Locked)
Challenge: Histograms33s
-
(Locked)
Solution: Histograms1m 18s
-
(Locked)
Saving plots and further exploration3m 41s
-
(Locked)
Key takeaways2m 12s
-
(Locked)
-
-
-
-
-