我无法将数据框中的数据类型转换为从字符串浮点型(它们是字符串或空字符串形式的数值):
calcMeanPrice_df = dessertApples_df.iloc[:, 5:17] #slice of columns
for col in calcMeanPrice_df: #iterate columns
pd.to_numeric(col, errors = 'coerce') #attempt to convert to numeric
calcMeanPrice_df.dtypes #return data column types
Out[21]:
4 object
5 object
6 object
7 object
8 object
9 object
10 object
11 object
12 object
13 object
14 object
15 object
dtype: object
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?