October 2019
Beginner to intermediate
674 pages
16h 43m
English
The pandas pivot_table function is more advanced than the pivot function in several ways. Let's discuss some interesting parameters of the pivot_table function:
Let's pivot the sample sales data to slice and dice Sales across Category and ShipMode. Note that when aggfunc is empty, the mean is calculated:
pd.pivot_table(sales_data, values = "Sales", index = "Category", columns = "ShipMode")
The following will be the output: ...
Read now
Unlock full access