Pivot tables are useful with a long list of data in a spreadsheet and presenting the summarized data as a function of one or more columns.

( ie the total sales $ per seller, or the total sales $ of each product or the total sales per week. . . )

If you are familiar with spreadsheets, you are probably thinking about using a pivot table to get the average of the variables for each cluster. In SQL, you would have probably used a GROUP BY statement. If you are not familiar with either of these, you may think of grouping each cluster together and then calculating the average for each of them.

To create a pivot table similar to a spreadsheets, we will be using the pivot_table() method from pandas.

If you are not familiar with using a pivot table in a spreadsheet, you can see the finished tables in the xlsx file using Libre Calc or MS Excel.

The python pandas pivot tables are the same.