0

Hello I wanted reshape my existing df:

Column A Column B Column C Column D
id 1 a b c
id 2 x y z

to the following:

Column A Column B
id 1 a
id 1 b
id 1 c
id 2 x
id 2 y
id 2 z

Basically it's like a transpose but keeps the columns as columns and appends the values from column B to the last column under column B and repeats the corresponding id value the column A for that row.

I'm new to pandas but tried a few basic functions like concat, but this use case is slightly different

Joseph
  • 1
  • 2

0 Answers0