Skip to content
Advertisement

pivot table raise error uniquely valued index error

I am trying to modify the following dataset in python 3/pandas

JavaScript

into a dataframe that will have the first columns or index to be the rank and the second column all the Maj value. Something like that:

JavaScript

JavaScript

I am trying to do that with a table pivot:

JavaScript

But get the following error:

JavaScript

But i do not have any duplicated value in the Rank. It goes from 2 to 50.

My main goal is to print Rank over Maj.

Thanks for your help

Advertisement

Answer

You can use np.reshape:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement