I am working with the following list variable. It is size 1, but contains many subsets of information.
adv = [
{
"season": 0,
"team": "string",
"conference": "string",
"offense": {
"plays": 0,
"drives": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0,
"powerSuccess": 0,
"stuffRate": 0,
"lineYards": 0,
"lineYardsTotal": 0,
"secondLevelYards": 0,
"secondLevelYardsTotal": 0,
"openFieldYards": 0,
"openFieldYardsTotal": 0,
"totalOpportunies": 0,
"pointsPerOpportunity": 0,
"fieldPosition": {
"averageStart": 0,
"averagePredictedPoints": 0
},
"havoc": {
"total": 0,
"frontSeven": 0,
"db": 0
},
"standardDowns": {
"rate": 0,
"ppa": 0,
"successRate": 0,
"explosiveness": 0
},
"passingDowns": {
"rate": 0,
"ppa": 0,
"successRate": 0,
"explosiveness": 0
},
"rushingPlays": {
"rate": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0
},
"passingPlays": {
"rate": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0
}
},
"defense": {
"plays": 0,
"drives": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0,
"powerSuccess": 0,
"stuffRate": 0,
"lineYards": 0,
"lineYardsTotal": 0,
"secondLevelYards": 0,
"secondLevelYardsTotal": 0,
"openFieldYards": 0,
"openFieldYardsTotal": 0,
"totalOpportunies": 0,
"pointsPerOpportunity": 0,
"fieldPosition": {
"averageStart": 0,
"averagePredictedPoints": 0
},
"havoc": {
"total": 0,
"frontSeven": 0,
"db": 0
},
"standardDowns": {
"rate": 0,
"ppa": 0,
"successRate": 0,
"explosiveness": 0
},
"passingDowns": {
"rate": 0,
"ppa": 0,
"successRate": 0,
"explosiveness": 0
},
"rushingPlays": {
"rate": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0
},
"passingPlays": {
"rate": 0,
"ppa": 0,
"totalPPA": 0,
"successRate": 0,
"explosiveness": 0
}
}
}
]
I am able to extract data at the first level by using the following:
adv = [
dict(
year = a.season,
team = a.team,
offense = a.offense,
defense = a.defense
) for a in adv]
df_adv = pd.DataFrame.from_records(adv).dropna()
However, I do not know how to get the subsets of further data within offense and defense.