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

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…

Contents