Skip to content

Commit 2a1ca9d

Browse files
TST: Retyping of categorical column with NaN (#60112)
* consistent name usage * changed to numpy array of integers * Remove redundant assert Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 9cd4a28 commit 2a1ca9d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/dtypes/test_dtypes.py

+9
Original file line numberDiff line numberDiff line change
@@ -1243,3 +1243,12 @@ def test_loc_setitem_empty_labels_no_dtype_conversion():
12431243

12441244
assert df.a.dtype == "int64"
12451245
tm.assert_frame_equal(df, expected)
1246+
1247+
1248+
def test_categorical_nan_no_dtype_conversion():
1249+
# GH 43996
1250+
1251+
df = pd.DataFrame({"a": Categorical([np.nan], [1]), "b": [1]})
1252+
expected = pd.DataFrame({"a": Categorical([1], [1]), "b": [1]})
1253+
df.loc[0, "a"] = np.array([1])
1254+
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)