【发布时间】:2019-12-20 13:45:05
【问题描述】:
我有以下 API 响应。这是一个非常小的子集,我在这里粘贴以供参考。这上面可以有 80 多列。
[["name","age","children","city", "info"], ["Richard Walter", "35", ["Simon", "Grace"], {"mobile":"yes","house_owner":"no"}],
["Mary", "43", ["Phil", "Marshall", "Emily"], {"mobile":"yes","house_owner":"yes", "own_stocks": "yes"}],
["Drew", "21", [], {"mobile":"yes","house_owner":"no", "investor":"yes"}]]
最初我认为 pandas 可以在这里提供帮助并相应地进行搜索,但作为 python/编码的新手,我无法从中获得太多帮助。感谢您提供任何帮助或指导。
我希望以 JSON 键值对格式输出,如下所示。
{"name":"Mary", "age":"43", "children":["Phil", "Marshall", "Emily"],"info_mobile":"yes","info_house_owner":"yes", "info_own_stocks": "yes"},
{"name":"Drew", "age":"21", "children":[], "info_mobile":"yes","info_house_owner":"no", "info_investor":"yes"}]```
【问题讨论】:
标签: python json pandas python-2.7 nested