【问题标题】:how can I change the ',' (thousand) to float?我怎样才能改变','(千)浮动?
【发布时间】:2022-07-07 23:22:54
【问题描述】:

我有一个包含数据的 csv,较大的数字使用“,”来分隔数千、数百万......

如何更改数据以使其变为浮点数?

例如。数据:1,234(1000 & 234 到 1234.00)

【问题讨论】:

标签: python


【解决方案1】:

您可以尝试为此使用 pandas:

import pandas as pd
df = pd.read_csv(Input, delimiter=" ", decimal=",")

【讨论】:

  • 除非您已经将它用于其他用途,否则 Pandas 方式解决此问题
猜你喜欢
  • 2022-10-01
  • 1970-01-01
  • 2011-09-06
  • 1970-01-01
  • 1970-01-01
  • 2019-01-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多