From 30d321557285bfbf63452d0e145f7a7b1b1db02d Mon Sep 17 00:00:00 2001 From: warm200 Date: Fri, 17 Jun 2022 11:14:52 -0400 Subject: [PATCH] PERF: Performance improvement on dataframe.update. setitem is doing copy under the hood and it's not updated in place --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 39a940169e1f3..8711d53353185 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8000,7 +8000,7 @@ def update( if mask.all(): continue - self[col] = expressions.where(mask, this, that) + self.loc[:, col] = expressions.where(mask, this, that) # ---------------------------------------------------------------------- # Data reshaping