简体   繁体   English

从Pandas中高度嵌套的JSON创建DataFrame吗?

[英]Create a DataFrame from a heavily nested JSON in Pandas?

I have a deeply nested JSON file taken from IBM's personality analysis tool. 我有一个深层嵌套的JSON文件,该文件取自IBM的个性分析工具。 What is the shortest way I can create a DataFrame out of it. 我可以用它创建DataFrame的最短方法是什么。 It doesn't matter if the parent "key" is repeated in multiple rows . 父“键”是否在多行中重复都没有关系 I can use multi indexing to make it look good. 我可以使用多重索引使其看起来不错。 My primary concern is to make spread out the JSON into a dataframe. 我主要关心的是将JSON散布到数据帧中。 Here is the link to the JSON: https://api.myjson.com/bins/vmdaf 这是JSON的链接: https : //api.myjson.com/bins/vmdaf

The json_normalize function is most likely what can help you out most here. json_normalize函数最有可能在这里为您提供最大帮助。

 from pandas.io.json import json_normalize

 df = json_normalize(my_json_blob)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM