问题: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()

成功: