From 6f8e1745472c9d107367da1e38494425c3938234 Mon Sep 17 00:00:00 2001 From: MeeseeksMachine <39504233+meeseeksmachine@users.noreply.github.com> Date: Wed, 16 Nov 2022 14:36:27 +0100 Subject: [PATCH] Backport PR #49720 on branch 1.5.x (Suppress spurious warning) (#49726) Backport PR #49720: Suppress spurious warning Co-authored-by: jbrockmendel --- pandas/core/frame.py | 4 +++- pandas/tests/frame/methods/test_update.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d3116f83d58cb..84d45b9e105c2 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8255,7 +8255,9 @@ def update( if mask.all(): continue - self.loc[:, col] = expressions.where(mask, this, that) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", "In a future version, `df.iloc") + self.loc[:, col] = expressions.where(mask, this, that) # ---------------------------------------------------------------------- # Data reshaping diff --git a/pandas/tests/frame/methods/test_update.py b/pandas/tests/frame/methods/test_update.py index a35530100a425..2903436337820 100644 --- a/pandas/tests/frame/methods/test_update.py +++ b/pandas/tests/frame/methods/test_update.py @@ -136,7 +136,8 @@ def test_update_from_non_df(self): def test_update_datetime_tz(self): # GH 25807 result = DataFrame([pd.Timestamp("2019", tz="UTC")]) - result.update(result) + with tm.assert_produces_warning(None): + result.update(result) expected = DataFrame([pd.Timestamp("2019", tz="UTC")]) tm.assert_frame_equal(result, expected)