diff --git a/pandas/tests/frame/methods/test_fillna.py b/pandas/tests/frame/methods/test_fillna.py index 8915d6f205d65..0868fcf573918 100644 --- a/pandas/tests/frame/methods/test_fillna.py +++ b/pandas/tests/frame/methods/test_fillna.py @@ -257,6 +257,19 @@ def test_fillna_categorical_nan(self): df = DataFrame({"a": Categorical(idx)}) tm.assert_frame_equal(df.fillna(value=NaT), df) + def test_fillna_with_categorical_series(self): + df = DataFrame( + {"cats": Categorical(["A", "B", "C"]), "ints": [1.0, 2.0, np.nan]} + ) + + filler = Series(Categorical([10.0, 20.0, 30.0])) + df.fillna({"ints": filler}, inplace=True) + + expected = DataFrame( + {"cats": Categorical(["A", "B", "C"]), "ints": [1.0, 2.0, 30.0]} + ) + tm.assert_frame_equal(df, expected) + def test_fillna_no_downcast(self, frame_or_series): # GH#45603 preserve object dtype obj = frame_or_series([1, 2, 3], dtype="object")