diff --git a/pandas/tests/dtypes/test_dtypes.py b/pandas/tests/dtypes/test_dtypes.py index 33232e8df14e9..b7e37ff270e60 100644 --- a/pandas/tests/dtypes/test_dtypes.py +++ b/pandas/tests/dtypes/test_dtypes.py @@ -1243,3 +1243,12 @@ def test_loc_setitem_empty_labels_no_dtype_conversion(): assert df.a.dtype == "int64" tm.assert_frame_equal(df, expected) + + +def test_categorical_nan_no_dtype_conversion(): + # GH 43996 + + df = pd.DataFrame({"a": Categorical([np.nan], [1]), "b": [1]}) + expected = pd.DataFrame({"a": Categorical([1], [1]), "b": [1]}) + df.loc[0, "a"] = np.array([1]) + tm.assert_frame_equal(df, expected)