这是在迭代时更新数据帧行的正确方法吗?

时间:2020-04-21 07:00:31

标签: python pandas

我正在使用.iterrows()方法遍历pandas DataFrame。

我想使用索引在迭代时更新行,如下面的代码所示:

import pandas as pd

for index, row in df.iterrows():
    row['name'] = get_new_name(row)
    df.loc[index] = row

0 个答案:

没有答案