How do I transpose dataframe in pandas without index?

You can set the index to your first column (or in general, the column you want to use as as index) in your dataframe first, then transpose the dataframe. For example if the column you want to use as index is 'Attribute', you can do:

df.set_index('Attribute',inplace=True)
df.transpose()

Or

df.set_index('Attribute').T

Leave a Comment