for i, row in df.iterrows():
if <something>:
row[column] = x
else:
row[column] = y
df.ix[i][column] = x
等价为:
df[column] = df.apply(lambda row: x if something else y, axis=1)
python Lambda 表达式处理csv数据
最新推荐文章于 2022-04-27 20:24:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)