|
9 | 9 | from pandas import (
|
10 | 10 | Categorical,
|
11 | 11 | CategoricalDtype,
|
| 12 | + DataFrame, |
12 | 13 | Index,
|
13 | 14 | NaT,
|
14 | 15 | Series,
|
@@ -56,17 +57,18 @@ def test_min_max_ordered(self, index_or_series_or_array):
|
56 | 57 | assert np.minimum.reduce(obj) == "d"
|
57 | 58 | assert np.maximum.reduce(obj) == "a"
|
58 | 59 |
|
59 |
| - def test_min_max_reduce_and_wrap(self): |
| 60 | + def test_min_max_reduce(self): |
60 | 61 | # GH52788
|
61 | 62 | cat = Categorical(["a", "b", "c", "d"], ordered=True)
|
| 63 | + df = DataFrame(cat) |
62 | 64 |
|
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) |
66 | 68 |
|
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) |
70 | 72 |
|
71 | 73 | @pytest.mark.parametrize(
|
72 | 74 | "categories,expected",
|
|
0 commit comments