I have a JSON file as follows:
{
"ALPHA": [
{
"date": "2021-06-22",
"constituents": {
"BBB": 0,
"EEE": 1,
"BTB": 1,
"YUY": 1
}
},
{
"date": "2021-09-07",
"constituents": {
"BBB": 0,
"EEE": 0,
"BTB": 0,
"YUY": 0
}
}
],
"BETA": [
{
"date": "2021-06-22",
"constituents": {
"BBB": 1,
"EEE": 1,
"BTB": 1,
"YUY": 1
}
},
{
"date": "2021-09-07",
"constituents": {
"BBB": 1,
"EEE": 1,
"BTB": 1,
"YUY": 1
}
}
],
"THETA": [
{
"date": "2021-06-22",
"constituents": {
"BBB": 0,
"EEE": 1,
"BTB": 1,
"YUY": 0
}
},
{
"date": "2021-08-20",
"constituents": {
"BBB": 0,
"EEE": 1,
"BTB": 1,
"YUY": 0
}
},
{
"date": "2021-09-07",
"constituents": {
"BBB": 0,
"EEE": 1,
"BTB": 1,
"YUY": 0
}
}
]
}
I want to read the above into a pandas data frame where the first index is the date, the second index is the first keys (i.e. "ALPHA", "BETA", "THETA"), the columns are the inner keys (i.e. "BBB" ,"EEE", "BTB" ,"YUY"), and the cell values are the values of these inner keys.
How can I read that into pandas from the JSON file?