Skip to content

Commit 87fd6fd

Browse files
authored
TST/bug: add test for NaT in Categorical.isin with empty string (#51587)
* TST: add test for NaT in Categorical with empty string * remove whatsnew entry
1 parent 7e19f39 commit 87fd6fd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/arrays/categorical/test_algos.py

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ def test_isin_cats():
5959
tm.assert_numpy_array_equal(expected, result)
6060

6161

62+
@pytest.mark.parametrize("value", [[""], [None, ""], [pd.NaT, ""]])
63+
def test_isin_cats_corner_cases(value):
64+
# GH36550
65+
cat = pd.Categorical([""])
66+
result = cat.isin(value)
67+
expected = np.array([True], dtype=bool)
68+
tm.assert_numpy_array_equal(expected, result)
69+
70+
6271
@pytest.mark.parametrize("empty", [[], pd.Series(dtype=object), np.array([])])
6372
def test_isin_empty(empty):
6473
s = pd.Categorical(["a", "b"])

0 commit comments

Comments
 (0)