I have a table of tracking height of person. the table for simplicity looks as follows:
| ID | Time | height |
|---|---|---|
| 0 | 10:00 | 1.7 |
| 0 | 10:05 | 1.5 |
| 1 | 10:00 | 1 |
| 1 | 10:05 | 1 |
| 1 | 10:10 | 1.1 |
I want to change it to be aggregated by id when time values are columns, and values themselves are height:
| ID | 10:00 | 10:05 | 10:10 |
|---|---|---|---|
| 0 | 1.7 | 1.5 | null |
| 1 | 1 | 1 | 1.1 |
i tried something like:
data.pivot_table(values=data['Height'], index=data['ID'], columns=data['Time'])
didnt workout for with pivottable or pivot...
can i do that?