I have the following DataFrame:
Month | ID | a | b | c |
---|---|---|---|---|
Jan | 1 | 0.1 | 0.3 | 0.5 |
Jan | 2 | 0.02 | 0.5 | 0.1 |
Jan | 3 | 0.1 | 0.4 | 0.7 |
Feb | 1 | 0.2 | 0.5 | 0.5 |
Feb | 2 | 0.3 | 0.1 | 0.3 |
Feb | 3 | 0.1 | 0.2 | 0.05 |
I want to transpose data to this format:
Month | a_1 | a_2 | a_3 | b_1 | b_2 | b_3 | c_1 | c_2 | c_3 |
---|---|---|---|---|---|---|---|---|---|
Jan | 0.1 | 0.02 | 0.1 | 0.3 | 0.5 | 0.4 | 0.5 | 0.1 | 0.7 |
Feb | 0.2 | 0.3 | 0.1 | 0.5 | 0.1 | 0.2 | 0.5 | 0.3 | 0.05 |
Can anyone direct me on how to do this? Thanks!