Suppose I have a pivot table like this:
import pandas as pd
d = {'Col_A': [1,2,3,3,3,4,9,9,10,11],
'Col_B': ['A','K','E','E','H','A','J','A','L','A'],
'Value1':[648,654,234,873,248,45,67,94,180,120],
'Value2':[180,120,35,654,789,34,567,21,235,83]
}
df = pd.DataFrame(data=d)
df_pvt = pd.pivot_table(df,values=['Value1','Value2'], index='Col_A', columns='Col_B', aggfunc=np.sum).fillna(0)
df_pvt
What I want to achieve is to set an order for Col_B (Highlighted) so that the outputs of Value1 and Value2 would display in this order E, J, A, K, L, H.
