I have a pandas dataframe like this:
c1 c2 c3 c4
0 1 2 3 0
1 10 20 30 1
2 100 200 300 2
3 1 2 3 0
4 10 20 30 1
5 100 200 300 2
I would like to transform in this:
c1 c2 c3 c4 c5 c6 c7 c8 c9
0 1 2 3 10 20 30 100 200 300
1 1 2 3 10 20 30 100 200 300
The idea is to "flatten" 3 rows at the time into one based on the value of "c4".
I have been trying to create a function to apply with the .apply method but with not much luck.