【发布时间】:2021-02-19 19:48:16
【问题描述】:
我正在尝试将下面的 JSON 结构读入 pandas 数据帧,但它会抛出错误消息:
ValueError:将 dicts 与非系列混合可能会导致排序不明确。
Json 数据: '''
{
"Name": "Bob",
"Mobile": 12345678,
"Boolean": true,
"Pets": ["Dog", "cat"],
"Address": {
"Permanent Address": "USA",
"Current Address": "UK"
},
"Favorite Books": {
"Non-fiction": "Outliers",
"Fiction": {"Classic Literature": "The Old Man and the Sea"}
}
}
''' 我怎样才能做到这一点?我试过下面的脚本...
'''
j_df = pd.read_json('json_file.json')
j_df
with open(j_file) as jsonfile:
data = json.load(jsonfile)
'''
【问题讨论】:
-
我需要以pandas数据框的形式导入这个jason数据。我该怎么做?
-
重复不匹配,所以重新打开。