I could read this nested JSON format in columnar format into pandas.
JSON Scheme
JSON scheme format
Python script
req = requests.get(REQUEST_API)
returned_data = json.loads(req.text)
# status
print("status: {0}".format(returned_data["status"]))
# api version
print("version: {0}".format(returned_data["version"]))
data_in_columnar_form = pd.DataFrame(returned_data["data"])
data = data_in_columnar_form["data"]
UPDATE
I want to convert the following JSON scheme into the tabular format as the table, how to ?
JSON Scheme
"data":[
{
"year":"2009",
"values":[
{
"Actual":"(0.2)"
},
{
"Upper End of Range":"-"
},
{
"Upper End of Central Tendency":"-"
},
{
"Lower End of Central Tendency":"-"
},
{
"Lower End of Range":"-"
}
]
},
{
"year":"2010",
"values":[
{
"Actual":"2.8"
},
{
"Upper End of Range":"-"
},
{
"Upper End of Central Tendency":"-"
},
{
"Lower End of Central Tendency":"-"
},
{
"Lower End of Range":"-"
}
]
},...
]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…