Skip to content

Commit 8282ee2

Browse files
authored
TST: Add Categorical Series test (#33525)
1 parent 0c55e91 commit 8282ee2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/reductions/test_reductions.py

+8
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,14 @@ def test_min_max_ordered(self, values, categories, function):
10981098
expected = categories[0] if function == "min" else categories[2]
10991099
assert result == expected
11001100

1101+
@pytest.mark.parametrize("function", ["min", "max"])
1102+
@pytest.mark.parametrize("skipna", [True, False])
1103+
def test_min_max_ordered_with_nan_only(self, function, skipna):
1104+
# https://github.com/pandas-dev/pandas/issues/33450
1105+
cat = Series(Categorical([np.nan], categories=[1, 2], ordered=True))
1106+
result = getattr(cat, function)(skipna=skipna)
1107+
assert result is np.nan
1108+
11011109
@pytest.mark.parametrize("function", ["min", "max"])
11021110
@pytest.mark.parametrize("skipna", [True, False])
11031111
def test_min_max_skipna(self, function, skipna):

0 commit comments

Comments
 (0)