I have a pandas dataframe object that looks like this:
one two three four five
0 1 2 3 4 5
1 1 1 1 1 1
Old question I know, but this makes more sense to me than these other answers.
If this is your dataframe:
df = pd.DataFrame({'one': [1, 1], 'three': [3, 1], 'four': [4, 1],
'five': [5, 1], 'two': [2, 1]},
columns=['one', 'two', 'three', 'four', 'five'])
Do this:
df.T.reset_index().values.tolist()
Result
[['one', 1, 1], ['two', 2, 1], ['three', 3, 1], ['four', 4, 1], ['five', 5, 1]]