From bfaf1ed51a2dfe493206d45ec47a451b12143c6d Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 16 Nov 2022 00:43:35 -0800 Subject: [PATCH] Backport PR #49720: Suppress spurious warning --- 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)