Home > Enterprise >  Transposing a dataframe with column 0 entries as new column names and column 1 entries as their resp
Transposing a dataframe with column 0 entries as new column names and column 1 entries as their resp

Time:05-23

I would like to change the dataframe such that the values in column 0 are new columns with there repective values coming from same index at column 1 for example for column name Agreement Number its value would be 59598840.So basically transposing this dataframe Could anybode tell how to do it?

Making the elements at column 0 as column names with there respective values at column 1

CodePudding user response:

Try:

df.set_index(0).transpose()

This sets your first column as an index and transposes a dataframe to give you desired column structure.

  • Related