human
Pandas: aggregate based on filter on another column
assistant
Here is some code to group dataframe `df` by columns 'Month' and 'Fruit'

df.groupby(['Month', 'Fruit']).sum().unstack(level=0)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.