I have a Dataframe in Pandas like this:
ID rating G1 G2 G3 G4 G5 G6 G7
0 1 2.5 18 0 0 0 0 0 0
1 4 4.0 18 0 0 0 0 0 0
2 7 3.0 78 1 0 0 0 0 0
3 1 4.0 21 7 8 10 30 40 20
4 21 3.0 18 0 0 0 0 0 0
5 7 2.0 18 80 10 11 8 0 0
6 41 3.5 18 0 9 10 0 0 0
and I would like gruoping all the elements by ID such to obtain a sort of continuos dataframe in pandas with row array entries like this:
ID H1 H2
0 1 [2.5,18] [4.0,21,7,8,10,30,40,20]
1 4 [4.0,18] Nan
2 7 [3.0,78] [2.0, 18, 80, 10, 11,8]
3 21 [3.0,18] Nan
4 41 [3.5,18,76,9,10] Nan
Do you know if it is possible? Thanks