diff --git a/pandas/tests/frame/methods/test_replace.py b/pandas/tests/frame/methods/test_replace.py index 555d24e747f44..177f3ec1b4504 100644 --- a/pandas/tests/frame/methods/test_replace.py +++ b/pandas/tests/frame/methods/test_replace.py @@ -1559,3 +1559,17 @@ def test_replace_with_value_also_being_replaced(self): result = df.replace({0: 1, 1: np.nan}) expected = DataFrame({"A": [1, np.nan, 2], "B": [np.nan, 1, 2]}) tm.assert_frame_equal(result, expected) + + def test_replace_categorical_no_replacement(self): + # GH#46672 + df = DataFrame( + { + "a": ["one", "two", None, "three"], + "b": ["one", None, "two", "three"], + }, + dtype="category", + ) + expected = df.copy() + + result = df.replace(to_replace=[".", "def"], value=["_", None]) + tm.assert_frame_equal(result, expected)