问题:object has no attribute"convert_objects"


遇到问题:

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

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”)

因此将代码改成

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

成功:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM