I am using Big Mart Sales Data set. https://www.kaggle.com/brijbhushannanda1979/bigmart-sales-data
The 2 concerning Features here are Outlet_Size and Outlet_Type.
Outlet_Size tells us whether Outlet is Small, Medium or High sized.
Outlet_Type tells us whether it is grocery, SupermaketType1,2 or 3.
I want to know count of each outlet type against each outlet size.
For ex. When I use group by, I get following result.
df.groupby(['Outlet_Type', 'Outlet_Size'])['Outlet_Size'].count()
Output:
Outlet_Type Outlet_Size
Grocery Store Small 528
Supermarket Type1 High 932
Medium 930
Small 1860
Supermarket Type2 Medium 928
Supermarket Type3 Medium 935
Name: Outlet_Size, dtype: int64
I wish to do similar thing using pivot table. Can someone show how to write pivot table for the same?