Reputation: 73
I have a Pandas DF and I need to:
Here is my DF before the transpostion:
Here is my Df after my failed transposition:
Upvotes: 0
Views: 764
Reputation: 152
After transposing, use:
df.columns = df.iloc[0]
to set column headers to the first row.
Then use the 'set_axis()' function to set indices for your rows. An explanation for this function is linked here
Upvotes: 1