I have a df
:
x
0 a
1 b
2 c
0 a
1 b
2 c
0 a
1 b
2 c
How can I turn those duplicated index values to new rows? Desired output:
x y z
0 a a a
1 b b b
2 c c c
I have been trying to add new columns to a dataframe through a loop with append
, but it just keeps giving me this output by adding rows instead of columns. I tried join
but that didn't work either, so i figured there must just be a hacky way to turn these repreated index values to new columns.