0

I need to pivot a pandas dataframe

ID A1 A2 B1 B2 C1 C2
1 100 102 99 103 100 100
2 90 92 89 93 90 90
3 120 122 119 123 120 120

into the following form

ID label_1 label_2
1 A1 100
1 A2 102
1 B1 99
1 B2 103
1 C1 100
1 C2 100
2 A1 90
2 A2 92
2 B1 89
2 B2 93
2 C1 90
2 C2 90
3 A1 120
3 A2 122
3 B1 119
3 B2 123
3 C1 120
3 C2 120

I tried different combinations of resetting the index, transposing and pivoting without any success.

Palilicium
  • 15
  • 4

0 Answers0