遇到問題:
今天用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()
成功: