I have the following DataFrame:
| ID | Week | A | B |
|---|---|---|---|
| 1 | 1 | 1 | 1 |
| 2 | 1 | 1 | 2 |
| 1 | 2 | 2 | 1 |
| 2 | 2 | 2 | 3 |
I now want to pivot the mean values in the DataFrame with the weeks as columns and the former columns as row entries in Type, so it can get this structure:
| Type | Week 1 | Week 2 | ... | Week N |
|---|---|---|---|---|
| A | 1 | 2 | ... | |
| B | 1.5 | 2 | ... |