为了账号安全,请及时绑定邮箱和手机立即绑定

python处理json文件

python处理json文件

www说 2019-05-25 14:12:44
代码如下:In:f=open('E:/python/data.json','r+')In:fOut:这个输出是什么意思?In:a=pd.Series(f)TypeErrorTraceback(mostrecentcalllast)in()---->1a=pd.Series(f)E:Anacondalibsite-packagespandascoreseries.pyin__init__(self,data,index,dtype,name,copy,fastpath)235ifnotis_list_like(data):236data=[data]-->237index=_default_index(len(data))238239#create/copythemanagerTypeError:objectoftype'_io.TextIOWrapper'hasnolen()出现错误不知道怎么修改,帮帮忙!
查看完整描述

2 回答

?
跃然一笑

TA贡献1826条经验 获得超6个赞

Out:<_io.TextIOWrappername='E:/python/data.json'mode='r+'encoding='cp936'>
#这个是个文件对象
pandas不熟,其余的就不知道了
                            
查看完整回答
反对 回复 2019-05-25
?
红颜莎娜

TA贡献1842条经验 获得超13个赞

is_list_like是什么?怎么定义的?报错信息是说data的值是_io.TextIOWrapper这个玩意,并不是list,所以len(data)不对
                            
查看完整回答
反对 回复 2019-05-25
  • 2 回答
  • 0 关注
  • 421 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号