2021年2月10日星期三

Alternative to apply function in pandas

I would like to execute this simple transformation in a more efficient way.

df["amount"] = df.apply(      lambda row: 500 if row.amount > 500 else row.amount, axis=1  )  

Any ideas?

https://stackoverflow.com/questions/66148501/alternative-to-apply-function-in-pandas February 11, 2021 at 11:49AM

没有评论:

发表评论