Skip to content

Commit 993eb85

Browse files
committed
TST: Add test for complex categories GH#16399
Signed-off-by: Liang Yan <[email protected]>
1 parent 3fbf49d commit 993eb85

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
@@ -1174,6 +1174,15 @@ def test_cast_string_to_complex():
11741174
tm.assert_frame_equal(result, expected)
11751175

11761176

1177+
def test_categorical_complex():
1178+
result = Categorical([1, 2 + 2j])
1179+
expected = Categorical([1.0 + 0.0j, 2.0 + 2.0j])
1180+
tm.assert_categorical_equal(result, expected)
1181+
result = Categorical([1, 2, 2 + 2j])
1182+
expected = Categorical([1.0 + 0.0j, 2.0 + 0.0j, 2.0 + 2.0j])
1183+
tm.assert_categorical_equal(result, expected)
1184+
1185+
11771186
def test_multi_column_dtype_assignment():
11781187
# GH #27583
11791188
df = pd.DataFrame({"a": [0.0], "b": 0.0})

0 commit comments

Comments
 (0)