From a3deb921003141b8d2214ceb26d8dd881f552d38 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:07:38 -0800 Subject: [PATCH] Support kurt/skew(axis=None) for multi columns/low row count --- python/cudf/cudf/core/dataframe.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 1057fd0b716..a3642bcc43f 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -57,6 +57,7 @@ is_string_dtype, ) from cudf.core import column, df_protocol, indexing_utils, reshape +from cudf.core._compat import PANDAS_GE_200 from cudf.core.abc import Serializable from cudf.core.column import ( CategoricalColumn, @@ -95,11 +96,8 @@ min_scalar_type, numeric_normalize_types, ) - from cudf.utils.nvtx_annotation import _cudf_nvtx_annotate from cudf.utils.utils import GetAttrGetItemMixin, _external_only_api -from cudf.core._compat import PANDAS_GE_200 - _cupy_nan_methods_map = { "min": "nanmin", @@ -6112,8 +6110,13 @@ def _reduce( if axis == 0 else source.index ) - if axis in {0, 2}: + if axis == 2 and op in ("kurtosis", "kurt", "skew"): + # TODO: concat + op can probably be done in the general case + # for axis == 2. + return getattr(concat_columns(source._data.columns), op)( + **kwargs + ) try: result = [ getattr(source._data[col], op)(**kwargs)