标签: pandas dataframe csv parsing casting
我有一个钱值列错误地显示为字符串:
money value as string
我尝试使用常用方法解析该列,但未成功:
astype(float) and pd.to_numeric(df.col, errors=['coerce'])
最后,我只有使用字符串操作技术才能获胜。如您所见,过于冗长:
apply split casting
那么,这里发生了什么?有没有优雅的方法来解决这个解析?
ps:使用 pd.read_csv(path, dtype={'receita': float} 我也错了
pd.read_csv(path, dtype={'receita': float}