From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Challenge: pivot() and melt()

Challenge: pivot() and melt()

- [Instructor] All right, everybody. We have a new email in from Chandler Capital. The subject line is Store Transactions Vs. Average. He writes us: "Hey, again, I need to summarize store numbers 1 through 11 by total bonus payable for each day of the week. Can you create a pivot table that has a sum of bonus payable by day of week? Make sure to filter out any rows that had 0 bonus payable first, and add a heatmap across the rows. Then unpivot the table so we have one row for each store and day of the week with the corresponding total owed. Thanks." All right, let's go ahead and take a look at the notebook. Okay, so we're going to be working with the table we created in assignment 4. We're going to be focused on store number, day of week, and bonus payable. We need to build a pivot table with the store number as our index, some day of week columns, and then the sum of bonus payable as our cells. We also want to make sure we filter out stores that had non-zero bonus payable, and then…

Contents