From fb0f0fbd8ecfe43112975940f6e05a4b079e9be0 Mon Sep 17 00:00:00 2001 From: RaphSku <45042665+RaphSku@users.noreply.github.com> Date: Thu, 15 Sep 2022 13:44:08 +0200 Subject: [PATCH] Backport PR #48562: TST: Testing that no warnings are emitted and that inplace fillna produces the correct result (GH48480) --- pandas/tests/frame/methods/test_fillna.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/tests/frame/methods/test_fillna.py b/pandas/tests/frame/methods/test_fillna.py index 3d7e5c6823e9d..697b28a65ac2e 100644 --- a/pandas/tests/frame/methods/test_fillna.py +++ b/pandas/tests/frame/methods/test_fillna.py @@ -780,3 +780,16 @@ def test_fillna_nonconsolidated_frame(): df_nonconsol = df.pivot(index="i1", columns="i2") result = df_nonconsol.fillna(0) assert result.isna().sum().sum() == 0 + + +def test_fillna_nones_inplace(): + # GH 48480 + df = DataFrame( + [[None, None], [None, None]], + columns=["A", "B"], + ) + with tm.assert_produces_warning(False): + df.fillna(value={"A": 1, "B": 2}, inplace=True) + + expected = DataFrame([[1, 2], [1, 2]], columns=["A", "B"]) + tm.assert_frame_equal(df, expected)