I have the following pandas dataframe.
ID Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9
1 A B C A B C A B C
2 D E F D E F D E F
I would like to get the following table by restructuring every three-column values.
ID Col_1 Col_2 Col_3
1 A B C
A B C
A B C
2 D E F
D E F
D E F
OR
ID Col_1 Col_2 Col_3
1 A B C
1 A B C
1 A B C
2 D E F
2 D E F
2 D E F
Is there any efficient way to do it? I tried to find similar examples here at the StackOverflow community but couldn't. If you have, you can point me.
Any help is appreciated!