For my pandas dataframe, I would like to convert all the values into tuples of the value itself and the column name for instance, a value of "a" in the column "x" would become (a, x). I have not come across a decent way to do this. For dataframe df df[column] does give the name of the column, I have not been able to retrieve it.
Overall, this is related to a larger problem, which I also have not been able to solve, and if there is some straigtforward way to do this, please tell: I have a dataframe of rows of test rounds, and the columns are the participants to the test, and the value is the participants score on the test.
For example:
John Mary Peter
1 9 3 3
2 0 8 5
3 3 1 4
I would like to organize this into a numpy array where the the names are ordered by their score in the test i.e.
[[John Mary Peter][Mary Peter John][Peter John Mary]]
Any ideas?