1

I have created a pivot table out of my original dataframe

id label value
1 abc 0.2
2 efg 0.4
3 abc 0.2
2 abc 0.4
1 efg 0.2
3 efg 0.4
df.pivot(index="id", columns="label", values="value")

which converts the original df to:

label

id abc efg
1 0.2 0.2
2 0.4 0.4
3 0.2 0.4

Now I would like to convert the above dataframe back to original dataframe, reset_index() is not the option for me here.

cattyWashington
  • 81
  • 1
  • 10

0 Answers0