随笔 - 299  文章 - 0  评论 - 0  阅读 - 6322 

问题:object has no attribute"convert_objects"

 

遇到问题:

今天用python将object数据转化为float数据时,用代码

1
2
df.runtime = df.runtime.convert_objects(convert_numeric=True)
df.runtime.describe()

出现如下错误:

 

 

问题解决:

查找资料后发现“.convert_objects(convert_numeric = True)”已弃用,需要改为:b = a.apply(pd.to_numeric, errors=“ignore”)

因此将代码改成

1
2
df.runtime = df.runtime.apply(pd.to_numeric, errors="ignore")
df.runtime.describe()

成功:

posted on   杨申龙  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示