Convert Json Nested List Of Dict To Dataframe
How can I convert the following list of dicts (json output) to a pandas DataFrame. I tried res = {} for d in list_of_dict: res.update(d) It gives me the error: ValueError: d
Solution 1:
Something like this will work:
I have assumed your json object is one large string named 'data'.
import pandas as pd
import json
# json object:
json_string = """ { "PlanCoverages": [ { "PlanId": 65860, ... """# 1) load json object as python variable:
data = json.loads(json_string)
# 2) convert to dataframe:
plan_coverages = pd.DataFrame(data['PlanCoverages'])
Post a Comment for "Convert Json Nested List Of Dict To Dataframe"