Skip to content

Commit 5634106

Browse files
committed
REF: add keepdims parameter to ExtensionArray._reduce + remove ExtensionArray._reduce_and_wrap
1 parent 49334c7 commit 5634106

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pandas/tests/arrays/categorical/test_analytics.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pandas import (
1010
Categorical,
1111
CategoricalDtype,
12+
DataFrame,
1213
Index,
1314
NaT,
1415
Series,
@@ -56,17 +57,18 @@ def test_min_max_ordered(self, index_or_series_or_array):
5657
assert np.minimum.reduce(obj) == "d"
5758
assert np.maximum.reduce(obj) == "a"
5859

59-
def test_min_max_reduce_and_wrap(self):
60+
def test_min_max_reduce(self):
6061
# GH52788
6162
cat = Categorical(["a", "b", "c", "d"], ordered=True)
63+
df = DataFrame(cat)
6264

63-
result_max = cat._reduce_and_wrap("max", kwargs={})
64-
expected_max = Categorical(["d"], dtype=cat.dtype)
65-
tm.assert_categorical_equal(result_max, expected_max)
65+
result_max = df.agg("max")
66+
expected_max = Series(Categorical(["d"], dtype=cat.dtype))
67+
tm.assert_series_equal(result_max, expected_max)
6668

67-
result_min = cat._reduce_and_wrap("min", kwargs={})
68-
expected_min = Categorical(["a"], dtype=cat.dtype)
69-
tm.assert_categorical_equal(result_min, expected_min)
69+
result_min = df.agg("min")
70+
expected_min = Series(Categorical(["a"], dtype=cat.dtype))
71+
tm.assert_series_equal(result_min, expected_min)
7072

7173
@pytest.mark.parametrize(
7274
"categories,expected",

0 commit comments

Comments
 (0)