How to convert a list with key-value pairs grouped by ID into rows (keys become columns)
I have a list, that stores for a set of people, a list of key value pairs, where there are many keys (like 40-60). Approximately like so:
| PID | Key | Value |
| A | name | Foo |
| A | height | 12 |
| A | weight | 421 |
| A | grade | 12 |
| A | … | … |
| B | name | Bar |
| B | height | 124 |
| B | weight | 98 |
| B | grade | 10 |
| B | … | … |
| C | name | Baz |
| C | height | 412 |
| C | weight | 12 |
| C | grade | 93 |
| C | … | … |
| … | | |I would like to turn it into a list, where each person has a single row, and the different keys become columns, like so
| PID | name | height | weight | grade | … |
| A | Foo | 12 | 421 | 12 | … |
| B | Bar | 124 | 98 | 10 | … |
| C | Baz | 412 | 12 | 93 | … |
| … | | | | | |All the keys may not always be present, so sometimes there are a few more or less elements to combine into a single row. Any help would be appreciated!