diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index 9073a1e31dfb0..bf0b4f2f7e470 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -897,13 +897,6 @@ def aggregate(self, func=None, *args, **kwargs): # raised directly by _aggregate_multiple_funcs raise result = self._aggregate_frame(func) - except NotImplementedError as err: - if "decimal does not support skipna=True" in str(err): - # FIXME: kludge for DecimalArray tests - pass - else: - raise - result = self._aggregate_frame(func) else: result.columns = Index( result.columns.levels[0], name=self._selected_obj.columns.name diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 280f1e88b0ea8..d23c16c989c48 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -1349,9 +1349,6 @@ def f(self, **kwargs): # raised in _get_cython_function, in some cases can # be trimmed by implementing cython funcs for more dtypes pass - elif "decimal does not support skipna=True" in str(err): - # FIXME: kludge for test_decimal:test_in_numeric_groupby - pass else: raise diff --git a/pandas/tests/extension/decimal/array.py b/pandas/tests/extension/decimal/array.py index 93816e3a8a613..f9ba4b7a8ba16 100644 --- a/pandas/tests/extension/decimal/array.py +++ b/pandas/tests/extension/decimal/array.py @@ -166,7 +166,14 @@ def _concat_same_type(cls, to_concat): def _reduce(self, name, skipna=True, **kwargs): if skipna: - raise NotImplementedError("decimal does not support skipna=True") + # If we don't have any NAs, we can ignore skipna + if self.isna().any(): + other = self[~self.isna()] + return other._reduce(name, **kwargs) + + if name == "sum" and len(self) == 0: + # GH#29630 avoid returning int 0 or np.bool_(False) on old numpy + return decimal.Decimal(0) try: op = getattr(self.data, name) diff --git a/pandas/tests/extension/decimal/test_decimal.py b/pandas/tests/extension/decimal/test_decimal.py index 86724d4d09819..ce819c13c4498 100644 --- a/pandas/tests/extension/decimal/test_decimal.py +++ b/pandas/tests/extension/decimal/test_decimal.py @@ -145,7 +145,7 @@ class TestMissing(BaseDecimal, base.BaseMissingTests): class Reduce: def check_reduce(self, s, op_name, skipna): - if skipna or op_name in ["median", "skew", "kurt"]: + if op_name in ["median", "skew", "kurt"]: with pytest.raises(NotImplementedError): getattr(s, op_name)(skipna=skipna)