Pandas data frame from nested dictionary in a single column Pandas data frame from nested dictionary in a single column json json

Pandas data frame from nested dictionary in a single column


When I look into your data I can see that the complication came from groups, so I decided to isolate it and work separately on it :

I decided to create a single data frame for every single group:

here is the code:

data_df = {}for category in data.get('Groups'):    #print(category)    data_df[category.get('Name')] = pd.DataFrame.from_records(category.get('Items'))

Here is the output for every group:

data_df['Faculty']Eligible    IsOtherItem Name    NonVoters   RelativeTurnout Turnout Voters0   7249    False   Faculty of Business, Law and Social Sciences    5880    4.779694    18.885363   13691   6226    False   Faculty of Arts, Design and Media   5187    3.627540    16.688082   10392   6156    False   Faculty of Computing, Engineering and the Buil...   5482    2.353188    10.948668   6743   8943    False   Faculty of Health, Education and Life Sciences  7958    3.439006    11.014201   9854   71  True    Other   56  0.052371    21.126761   15

And Age-Range :

Eligible    IsOtherItem Name    NonVoters   RelativeTurnout Turnout Voters0   13246   False   18 - 21 10657   9.039173    19.545523   25891   6785    False   22 - 25 5939    2.953704    12.468681   8462   3133    False   26 - 30 2862    0.946163    8.649856    2713   5392    False   Over 30 5024    1.284826    6.824926    368

and others groups.

The remaining part is just information dictionary:

del data['Groups']

You can create a serie from them or another dataframe.

If you know how the data was generated you can do futher analysis and build your data.frame