Given a DataFrame with the following structure:
Date | Site | Measurement Type | Value
-----------------------------------------------
1/1/2020 | A | Temperature | 32.3
1/2/2020 | B | Humidity | 70%
I would like to create a 3D "pivot table" where the first axis represents site, the second represents date, the third represents measurement type, and values are stored in each element.
For example, if I had daily measurements for one week at 5 sites, measuring both Temperature and Humidity, the desired output would be an array with shape (5, 7, 2).
Pandas only seems to support creating 2D pivot tables, but I'm happy with just an unlabeled 3D numpy array as output. Wondering if there's an existing easy way to do this before I spend time implementing it myself.