I used the pandas.pivot_table
function on a pandas dataframe and my output looks like something simillar to this:
Winners Runnerup
year 2016 2015 2014 2016 2015 2014
Country Sport
india badminton
india wrestling
What I actually needed was some thing like below
Country Sport Winners_2016 Winners_2015 Winners_2014 Runnerup_2016 Runnerup_2015 Runnerup_2014
india badminton 1 1 1 1 1 1
india wrestling 1 0 1 0 1 0
I have lot of columns and years so I will not be able to manually edit them, so can anyone please advise me on how to do this ?