i have data frame
data=pd.DataFrame({'year':[2010,2010,2010,2011,2011,2011],
'position':[1,2,3,1,2,3],
'name':['a','a','b','c','c','d'],
'points':[34,36,32,14,15,16],
'team':['A','B','C','C','B','A'],
'venue':['ny','ny','ny','cali','cali','cali']})
my code:
data.pivot(index=['position','name'],columns='year',values='points')
It works but for the actual dataset I have to put the year as index otherwise it says duplicate index can we solve I need year in the index and also columns