解析 str 以在 Pandas 中浮动的最佳方法

时间:2021-03-09 13:40:16

标签: 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} 我也错了

0 个答案:

没有答案
相关问题