My Dataframe looks like this.
id | age | Gender | snapshot_1 | performance_13 | snapshot_5 | performance_17 | snapshot_7 | performance_19 |
---|---|---|---|---|---|---|---|---|
1 | 34 | M | 80 | 30 | 40 | 30 | ||
2 | 42 | F | 65 | 55 | 60 | 15 | 25 | 45 |
ALL Id's data need to be grouped for snapshot/performance with ID repetition like below. For Snapshot and its corresponding performance window could be fetched from the number after underscore from 1st dataframe.
ID | Age | Gender | Snapshot_Window | Performance_window | Snapshot_Value | Performance_Value |
---|---|---|---|---|---|---|
1 | 34 | M | 1 | 13 | ||
2 | 42 | F | 1 | 13 | 65 | 55 |
1 | 34 | M | 5 | 17 | 80 | 30 |
2 | 42 | F | 5 | 17 | 60 | 15 |
1 | 34 | M | 7 | 19 | 40 | 30 |
2 | 42 | F | 7 | 19 | 25 | 45 |