Open oldoc63 opened 2 years ago
In the previous shoefly example, a DataFrame with the total number of shoes of each shoe_type / shoe_color combination was created. The purchasing manager complains that this DataFrame is confusing. Make it easier for her to compare purchases of different shoe colors of the same shoe type by creating a pivot table. Save your results to the variable shoe_counts_pivot.
When we perform a groupby across multiple columns, we often want to change how our data is stored. For instance, recall the example where we are running a chain of stores and have data about the number of sales at different locations on different days. In order to test our hypothesis it would be more useful if the table was formatted differently. Reorganizing a table in this way is called pivoting. The new table is called a pivot table.