Input Dataframe
id P1 x1 y1 P2 x2 y2 P3 x3 y3
0 _1 a 1 aa b 2 bb c 3 cc
1 _2 d 4 dd e 5 ee f 6 ff
I would like to transform it to get below output
id Probability code number name
0 -1 P1 a 1 aa
1 -1 P2 b 2 bb
2 -1 P3 c 3 cc
3 -2 P1 d 4 dd
4 -2 P2 e 5 ee
5 -2 P3 f 6 ff
I appreciate your guidance