I have a requirement where in I am trying to count the values and Put them in the pivot table.
This is my dataframe,
Cola Colb Ap
Using my favourite: pd.crosstab
pd.crosstab
df = pd.crosstab(df.Cola, df.Colb) print(df) Colb Rippened UnRippened Cola Apple 1 1 Mango 0 1 Orange 1 0