数据加载、存储于文件格式:JSON数据
import json from pandas import DataFrame obj = """ {"orderBy":"default","orderWay":"desc","pageNo":1,"pageSize":15,"conditions":[{"name":"aaa","age":25,"pet":"zuko"},{"name":"bbb","age":30}],"filter":{"type":"mine","keywords":""}} """ # json.loads 将json字符串转换为python形式 result = json.loads(obj) # json.dumps 将python对象转换成json格式 asjson = json.dumps(result) # 将一组json对象转换为DataFrame siblings = DataFrame(result['conditions'],columns=['name','age']) print(siblings) ''' name age 0 aaa 25 1 bbb 30 '''
本文来自博客园,作者:OTAKU_nicole,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/14420678.html