我在每列中都有一个数据框,我有数字,但类型是object!如何将对象转换为浮点
我试过这个:
pd.to_numeric(df['Close_x'],errors='coerce')
但错误是:
TypeError: arg must be a list, tuple, 1-d array, or Series
我试过concatenated['Close_x'].astype(float)
错误显示:
ValueError: could not convert string to float: '1,001.96'
Tags:
这些数字以
,
作为分隔符,因此首先需要将其替换为空字符串,然后将其转换为浮点数或
注意:
df.apply
对于大数据帧比pd.to_numeric
慢相关问题 更多 >
编程相关推荐