当我还需要将,更改为时,如何将多列更改为浮点数。
DF 看起来像这样 除了我删除了所有 NAN 值,因为我不需要这些行。
这是数据类型
这就是我现在做的方式,但需要很长时间。我知道你可以做一个循环,但我不明白怎么做。
使用df.iloc:
df.iloc
df.iloc[:,2:] = df.iloc[:,2:].replace(',','.',regex=True).astype(float)