Pandas dataframe to pivot_table : I have a df dataframe with 4 columns 'year', 'cath1', 'cath2' and 'cath3'
and 2000 entries corresponding to products, with corresponding year of production, and a value in each 3 cathegories.

i would like to create another dataframe with the same 3 cathegory columns and compute the average value of all products for each specific year in each of these cathegories.

i tried with the folling code but it does not work.
Thank you for your help

df1=pd.pivot_table(df,index=['year'],values=['0','1','2'],aggfunc=np.mean)

Exception has occurred: KeyError
'0'

