I have data in a JSON object in the form of (errors are error codes representing a specific occurred error):
[{
"timestamp": "2018-12-16 16:04:31.000000000",
"error": "8022"
},
{
"timestamp": "2018-12-16 16:04:41.000000000",
"error": "8022"
},
{
"timestamp": "2018-12-16 16:04:51.000000000",
"error": "8008"
},
{
"timestamp": "2018-12-16 16:05:02.000000000",
"error": "3005"
}, ...]
Now I want to do a heatmap plot like this:
with x-axis beeing the timestamp axis with all occuring timestamps
y-axis the categorical error codes with all occurring error codes set to 1 if occurred and set to 0 if not occurred
However, I absolutely can’t figure out how to prepare my data to get the needed z-array. I tried map and reduce functions to rearrange my JSON object, but that did not bring me any close to generating a heatmap from the data. I guess I need something like “pivot” or “unstack”.