pandas read_json报错ValueError: If using all scalar values, you must pass an index;pickle文件读取

1 、添加typ='series’即可

pandas read_json报错ValueError: If using all scalar values, you must pass an index;pickle文件读取_第1张图片

参考:https://www.pythonheidong.com/blog/article/298548/25b1be309679dc8e1e9b/

pd.read_json(a, typ='series')

pandas read_json报错ValueError: If using all scalar values, you must pass an index;pickle文件读取_第2张图片

或者这样打开:
import json
with open('peopl****word.json', 'r') as f:
    data = json.load(f)

read_json读取字段字符串自动转换成int整数错误,指定下dtype解决

pd.read_json(a,dtype={"dnum":str})

2、pickle文件读取

import pickle
fr=open('test_results.pkl','rb')
inf = pickle.load(fr)

你可能感兴趣的:(知识点,python,pandas,python,elasticsearch)