Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我还需要更改时,如何将多列更改为浮点数。
DF 看起来像这样, 除了我删除了所有 NAN 值,因为我不需要这些行。
这是数据类型
这就是我现在做的方式,但这需要很长时间。我知道你可以做一个循环,但我不明白怎么做。
使用df.iloc:
df.iloc
df.iloc[:, 2:] = df.iloc[:, 2:].replace(',', '.', regex=True).astype(float)