I would need assistance in transforming a Data-frame. the structure is currently like this:
id | date | color | value |
---|---|---|---|
0 | 25.05.20 | Red | 245 |
0 | 25.05.20 | Blue | 245 |
0 | 25.05.20 | Orange | 220 |
0 | 25.05.20 | Red | 230 |
0 | 26.05.20 | Orange | 220 |
0 | 26.05.20 | Red | 230 |
1 | 25.05.20 | Red | 245 |
1 | 25.05.20 | Blue | 245 |
1 | 25.05.20 | Orange | 220 |
1 | 25.05.20 | Red | 230 |
1 | 26.05.20 | Orange | 220 |
1 | 26.05.20 | Red | 230 |
In the end the dataframe should look like this:
id | date | Red | Blue | Orange |
---|---|---|---|---|
0 | 25.05.20 | 245 | 245 | 220 |
0 | 26.05.20 | 230 | 0 | 220 |
1 | 25.05.20 | 245 | 245 | 220 |
1 | 26.05.20 | 230 | 0 | 220 |
I want to display the colors in columns for each ID and enter the values there. Furthermore, if several values have been entered for a color on one day, only the highest value should be taken. If no value is available for a color on the date, a 0 should be entered.
Thanks in advance