table = pd.pivot_table(data=df,index='category',values='num_orders',aggfunc=np.sum) table