I have a dataframe that looks like
| Name | Class | id | C-id | Main ID |
|---|---|---|---|---|
| ABC | XC | 1 | 1 | M1 |
| ZTC | CVF | 2 | 1 | M1 |
| ABK1 | XCD | 1 | 2 | M1 |
| ZTH1 | CVFD | 2 | 2 | M1 |
I want the output to look like that
| Name | Class | Name_m | Class_m | C-id | Main ID |
|---|---|---|---|---|---|
| ABC | XC | ZTC | CVF | 1 | M1 |
| ABK1 | XCD | ZTH1 | CVFD | 2 | M1 |
Can someone please suggest how I can accomplish this with the least hardcoding possible.
One idea I have is to separate the records with id=1 and id =2 and merge again