From 53f38205471d9f22e1e65527a9f5a24966d0cafe Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Mon, 7 Aug 2023 18:57:58 -0700 Subject: [PATCH 01/11] Add warning messages --- python/cudf/cudf/core/dataframe.py | 19 +++++-- python/cudf/cudf/core/frame.py | 52 +++++++++++++++----- python/cudf/cudf/core/indexed_frame.py | 2 +- python/cudf/cudf/core/single_column_frame.py | 7 +-- 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 0298dd103f5..475a9a144c6 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -2557,7 +2557,7 @@ def reindex( "Cannot specify both 'axis' and any of 'index' or 'columns'." ) - axis = self._get_axis_from_axis_arg(axis) + axis = 0 if axis is None else self._get_axis_from_axis_arg(axis) if axis == 0: if index is None: index = labels @@ -5798,7 +5798,7 @@ def count(self, axis=0, level=None, numeric_only=False, **kwargs): _SUPPORT_AXIS_LOOKUP = { 0: 0, 1: 1, - None: 0, + # None: 0, "index": 0, "columns": 1, } @@ -5826,7 +5826,20 @@ def _reduce( if source.empty: return Series(index=cudf.Index([], dtype="str")) - axis = source._get_axis_from_axis_arg(axis) + if axis is None: + warnings.warn( + f"In a future version, {type(self).__name__}" + f".{op}(axis=None) will return a scalar {op} over " + "the entire DataFrame. To retain the old behavior, " + f"use '{type(self).__name__}.{op}(axis=0)' or " + f"just '{type(self)}.{op}()'", + FutureWarning, + ) + axis = 0 + if axis is no_default: + axis = 0 + else: + axis = source._get_axis_from_axis_arg(axis) if axis == 0: try: diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index 466a704c56e..b5486eacb5d 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -31,6 +31,7 @@ import cudf from cudf import _lib as libcudf from cudf._typing import Dtype +from cudf.api.extensions import no_default from cudf.api.types import is_bool_dtype, is_dtype_equal, is_scalar from cudf.core.buffer import acquire_spill_lock from cudf.core.column import ( @@ -1885,7 +1886,7 @@ def _reduce(self, *args, **kwargs): @_cudf_nvtx_annotate def min( self, - axis=None, + axis=no_default, skipna=True, level=None, numeric_only=None, @@ -1936,7 +1937,7 @@ def min( @_cudf_nvtx_annotate def max( self, - axis=None, + axis=no_default, skipna=True, level=None, numeric_only=None, @@ -1987,7 +1988,7 @@ def max( @_cudf_nvtx_annotate def sum( self, - axis=None, + axis=no_default, skipna=True, dtype=None, level=None, @@ -2045,7 +2046,7 @@ def sum( @_cudf_nvtx_annotate def product( self, - axis=None, + axis=no_default, skipna=True, dtype=None, level=None, @@ -2089,7 +2090,19 @@ def product( b 5040 dtype: int64 """ - axis = self._get_axis_from_axis_arg(axis) + if axis in {no_default, None}: + if axis is None: + warnings.warn( + f"In a future version, {type(self).__name__}" + f".product(axis=None) will return a scalar product over " + "the entire DataFrame. To retain the old behavior, " + f"use '{type(self).__name__}.product(axis=0)' or " + f"just '{type(self)}.product()'", + FutureWarning, + ) + axis = 0 + else: + axis = self._get_axis_from_axis_arg(axis) return self._reduce( # cuDF columns use "product" as the op name, but cupy uses "prod" # and we need cupy if axis == 1. @@ -2108,7 +2121,12 @@ def product( @_cudf_nvtx_annotate def mean( - self, axis=None, skipna=True, level=None, numeric_only=None, **kwargs + self, + axis=no_default, + skipna=True, + level=None, + numeric_only=None, + **kwargs, ): """ Return the mean of the values for the requested axis. @@ -2154,7 +2172,7 @@ def mean( @_cudf_nvtx_annotate def std( self, - axis=None, + axis=no_default, skipna=True, level=None, ddof=1, @@ -2210,7 +2228,7 @@ def std( @_cudf_nvtx_annotate def var( self, - axis=None, + axis=no_default, skipna=True, level=None, ddof=1, @@ -2264,7 +2282,12 @@ def var( @_cudf_nvtx_annotate def kurtosis( - self, axis=None, skipna=True, level=None, numeric_only=None, **kwargs + self, + axis=no_default, + skipna=True, + level=None, + numeric_only=None, + **kwargs, ): """ Return Fisher's unbiased kurtosis of a sample. @@ -2305,7 +2328,7 @@ def kurtosis( b -1.2 dtype: float64 """ - if axis not in (0, "index", None): + if axis not in (0, "index", None, no_default): raise NotImplementedError("Only axis=0 is currently supported.") return self._reduce( @@ -2322,7 +2345,12 @@ def kurtosis( @_cudf_nvtx_annotate def skew( - self, axis=None, skipna=True, level=None, numeric_only=None, **kwargs + self, + axis=no_default, + skipna=True, + level=None, + numeric_only=None, + **kwargs, ): """ Return unbiased Fisher-Pearson skew of a sample. @@ -2366,7 +2394,7 @@ def skew( b -0.37037 dtype: float64 """ - if axis not in (0, "index", None): + if axis not in (0, "index", None, no_default): raise NotImplementedError("Only axis=0 is currently supported.") return self._reduce( diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index e6ac34f2290..51a2d085d00 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -3421,7 +3421,7 @@ def sample( 0 1 3 1 2 4 """ - axis = self._get_axis_from_axis_arg(axis) + axis = 0 if axis is None else self._get_axis_from_axis_arg(axis) size = self.shape[axis] # Compute `n` from parameter `frac`. diff --git a/python/cudf/cudf/core/single_column_frame.py b/python/cudf/cudf/core/single_column_frame.py index 0edad039444..1bf757e8604 100644 --- a/python/cudf/cudf/core/single_column_frame.py +++ b/python/cudf/cudf/core/single_column_frame.py @@ -11,6 +11,7 @@ import cudf from cudf._typing import Dtype, NotImplementedType, ScalarLike +from cudf.api.extensions import no_default from cudf.api.types import ( _is_scalar_or_zero_d_array, is_bool_dtype, @@ -30,7 +31,7 @@ class SingleColumnFrame(Frame, NotIterable): _SUPPORT_AXIS_LOOKUP = { 0: 0, - None: 0, + # None: 0, "index": 0, } @@ -38,12 +39,12 @@ class SingleColumnFrame(Frame, NotIterable): def _reduce( self, op, - axis=None, + axis=no_default, level=None, numeric_only=None, **kwargs, ): - if axis not in (None, 0): + if axis not in (None, 0, no_default): raise NotImplementedError("axis parameter is not implemented yet") if level is not None: From 85832ec08e43f62ba8ff2fcb626d140e949b6394 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 10:40:01 -0700 Subject: [PATCH 02/11] Make the fix and add tests --- python/cudf/cudf/core/dataframe.py | 42 ++++++++++++++--------- python/cudf/cudf/tests/test_reductions.py | 23 +++++++++++++ 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 475a9a144c6..af908adc832 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -5827,21 +5827,24 @@ def _reduce( return Series(index=cudf.Index([], dtype="str")) if axis is None: - warnings.warn( - f"In a future version, {type(self).__name__}" - f".{op}(axis=None) will return a scalar {op} over " - "the entire DataFrame. To retain the old behavior, " - f"use '{type(self).__name__}.{op}(axis=0)' or " - f"just '{type(self)}.{op}()'", - FutureWarning, - ) - axis = 0 - if axis is no_default: + if op in {"any", "all"}: + axis = 2 + else: + warnings.warn( + f"In a future version, {type(self).__name__}" + f".{op}(axis=None) will return a scalar {op} over " + "the entire DataFrame. To retain the old behavior, " + f"use '{type(self).__name__}.{op}(axis=0)' or " + f"just '{type(self)}.{op}()'", + FutureWarning, + ) + axis = 0 + elif axis is no_default: axis = 0 else: axis = source._get_axis_from_axis_arg(axis) - if axis == 0: + if axis in {0, 2}: try: result = [ getattr(source._data[col], op)(**kwargs) @@ -5880,7 +5883,10 @@ def _reduce( ) source = self._get_columns_by_label(numeric_cols) if source.empty: - return Series(index=cudf.Index([], dtype="str")) + if axis == 2: + return getattr(as_column([]), op)(**kwargs) + else: + return Series(index=cudf.Index([], dtype="str")) try: result = [ getattr(source._data[col], op)(**kwargs) @@ -5892,12 +5898,16 @@ def _reduce( ) else: raise - - return Series._from_data( - {None: result}, as_index(source._data.names) - ) + if axis == 2: + return getattr(as_column(result), op)(**kwargs) + else: + return Series._from_data( + {None: result}, as_index(source._data.names) + ) elif axis == 1: return source._apply_cupy_method_axis_1(op, **kwargs) + else: + raise ValueError(f"Incorrect value of {axis=} received for {op}") @_cudf_nvtx_annotate def _scan( diff --git a/python/cudf/cudf/tests/test_reductions.py b/python/cudf/cudf/tests/test_reductions.py index c549ac20f59..8dd641e1842 100644 --- a/python/cudf/cudf/tests/test_reductions.py +++ b/python/cudf/cudf/tests/test_reductions.py @@ -306,3 +306,26 @@ def test_categorical_reductions(op): psr = gsr.to_pandas() utils.assert_exceptions_equal(getattr(psr, op), getattr(gsr, op)) + + +@pytest.mark.parametrize( + "data", + [ + {"a": [1, 2, 3], "b": [10, 11, 12]}, + {"a": [1, 0, 3], "b": [10, 11, 12]}, + {"a": [1, 2, 3], "b": [10, 11, None]}, + { + "a": [], + }, + {}, + ], +) +@pytest.mark.parametrize("op", ["all", "any"]) +def test_any_all_axis_none(data, op): + gdf = cudf.DataFrame(data) + pdf = gdf.to_pandas() + + expected = getattr(pdf, op)(axis=None) + actual = getattr(gdf, op)(axis=None) + + assert expected == actual From 0a4c211855415bf86320be9e96b544d163ed7e68 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 10:51:05 -0700 Subject: [PATCH 03/11] Add fixes and tests --- python/cudf/cudf/core/dataframe.py | 1 + python/cudf/cudf/core/frame.py | 1 + python/cudf/cudf/tests/test_reductions.py | 37 ++++++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index af908adc832..110487c8ac9 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -5830,6 +5830,7 @@ def _reduce( if op in {"any", "all"}: axis = 2 else: + # Do not remove until pandas 2.0 support is added. warnings.warn( f"In a future version, {type(self).__name__}" f".{op}(axis=None) will return a scalar {op} over " diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index b5486eacb5d..5d3034826f9 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -2092,6 +2092,7 @@ def product( """ if axis in {no_default, None}: if axis is None: + # Do not remove until pandas 3.0 support is added. warnings.warn( f"In a future version, {type(self).__name__}" f".product(axis=None) will return a scalar product over " diff --git a/python/cudf/cudf/tests/test_reductions.py b/python/cudf/cudf/tests/test_reductions.py index 8dd641e1842..47968ec1d97 100644 --- a/python/cudf/cudf/tests/test_reductions.py +++ b/python/cudf/cudf/tests/test_reductions.py @@ -12,7 +12,12 @@ from cudf import Series from cudf.core.dtypes import Decimal32Dtype, Decimal64Dtype, Decimal128Dtype from cudf.testing import _utils as utils -from cudf.testing._utils import NUMERIC_TYPES, assert_eq, gen_rand +from cudf.testing._utils import ( + NUMERIC_TYPES, + assert_eq, + expect_warning_if, + gen_rand, +) params_dtype = NUMERIC_TYPES @@ -329,3 +334,33 @@ def test_any_all_axis_none(data, op): actual = getattr(gdf, op)(axis=None) assert expected == actual + + +@pytest.mark.parametrize( + "op", + [ + "sum", + "product", + "std", + "var", + "kurt", + "kurtosis", + "skew", + "min", + "max", + "mean", + "median", + ], +) +def test_reductions_axis_none_warning(op): + df = cudf.DataFrame({"a": [1, 2, 3], "b": [10, 2, 3]}) + pdf = df.to_pandas() + with pytest.warns(FutureWarning): + actual = getattr(df, op)(axis=None) + with expect_warning_if( + op in {"kurt", "kurtosis", "skew", "min", "max", "mean", "median"}, + FutureWarning, + ): + expected = getattr(pdf, op)(axis=None) + + assert_eq(expected, actual, check_dtype=False) From ffed3acc7f461a86a3afc3dd08ed42dd731b3861 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 11:04:45 -0700 Subject: [PATCH 04/11] cleanup --- python/cudf/cudf/core/dataframe.py | 1 - python/cudf/cudf/core/frame.py | 9 +++++++++ python/cudf/cudf/core/single_column_frame.py | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 110487c8ac9..17b4b651373 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -5798,7 +5798,6 @@ def count(self, axis=0, level=None, numeric_only=False, **kwargs): _SUPPORT_AXIS_LOOKUP = { 0: 0, 1: 1, - # None: 0, "index": 0, "columns": 1, } diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index 5d3034826f9..c7ec59d9f65 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -2414,6 +2414,15 @@ def all(self, axis=0, skipna=True, level=None, **kwargs): Parameters ---------- + axis : {0 or 'index', 1 or 'columns', None}, default 0 + Indicate which axis or axes should be reduced. For `Series` + this parameter is unused and defaults to `0`. + + - 0 / 'index' : reduce the index, return a Series + whose index is the original column labels. + - 1 / 'columns' : reduce the columns, return a Series + whose index is the original index. + - None : reduce all axes, return a scalar. skipna: bool, default True Exclude NA/null values. If the entire row/column is NA and skipna is True, then the result will be True, as for an diff --git a/python/cudf/cudf/core/single_column_frame.py b/python/cudf/cudf/core/single_column_frame.py index 1bf757e8604..ffb432ed14a 100644 --- a/python/cudf/cudf/core/single_column_frame.py +++ b/python/cudf/cudf/core/single_column_frame.py @@ -31,7 +31,6 @@ class SingleColumnFrame(Frame, NotIterable): _SUPPORT_AXIS_LOOKUP = { 0: 0, - # None: 0, "index": 0, } From d901a159a45f3031dbab2b3ba0bcef90cde8bb78 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 11:13:48 -0700 Subject: [PATCH 05/11] docstring update --- python/cudf/cudf/core/frame.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index c7ec59d9f65..b281446b321 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -2418,10 +2418,10 @@ def all(self, axis=0, skipna=True, level=None, **kwargs): Indicate which axis or axes should be reduced. For `Series` this parameter is unused and defaults to `0`. - - 0 / 'index' : reduce the index, return a Series - whose index is the original column labels. - - 1 / 'columns' : reduce the columns, return a Series - whose index is the original index. + - 0 or 'index' : reduce the index, return a Series + whose index is the original column labels. + - 1 or 'columns' : reduce the columns, return a Series + whose index is the original index. - None : reduce all axes, return a scalar. skipna: bool, default True Exclude NA/null values. If the entire row/column is NA and @@ -2436,7 +2436,7 @@ def all(self, axis=0, skipna=True, level=None, **kwargs): Notes ----- - Parameters currently not supported are `axis`, `bool_only`, `level`. + Parameters currently not supported are `bool_only`, `level`. Examples -------- @@ -2462,6 +2462,15 @@ def any(self, axis=0, skipna=True, level=None, **kwargs): Parameters ---------- + axis : {0 or 'index', 1 or 'columns', None}, default 0 + Indicate which axis or axes should be reduced. For `Series` + this parameter is unused and defaults to `0`. + + - 0 or 'index' : reduce the index, return a Series + whose index is the original column labels. + - 1 or 'columns' : reduce the columns, return a Series + whose index is the original index. + - None : reduce all axes, return a scalar. skipna: bool, default True Exclude NA/null values. If the entire row/column is NA and skipna is True, then the result will be False, as for an @@ -2475,7 +2484,7 @@ def any(self, axis=0, skipna=True, level=None, **kwargs): Notes ----- - Parameters currently not supported are `axis`, `bool_only`, `level`. + Parameters currently not supported are `bool_only`, `level`. Examples -------- From 6611766a5f157df35321925fc7a77463a1b83cc9 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 11:57:14 -0700 Subject: [PATCH 06/11] np fix --- python/cudf/cudf/core/dataframe.py | 5 +++++ python/cudf/cudf/tests/test_array_function.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 17b4b651373..40d177b68fe 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -1333,6 +1333,11 @@ def __array_function__(self, func, types, args, kwargs): return NotImplemented try: + if func.__name__ in {"any", "all"}: + # Numpy default for `axis` if + # different from `cudf`/`pandas` + # hence need this special handling. + kwargs.setdefault("axis", None) if cudf_func := getattr(self.__class__, func.__name__, None): out = cudf_func(*args, **kwargs) # The dot product of two DataFrames returns an array in pandas. diff --git a/python/cudf/cudf/tests/test_array_function.py b/python/cudf/cudf/tests/test_array_function.py index a355ebb40b2..64fa0c2bdba 100644 --- a/python/cudf/cudf/tests/test_array_function.py +++ b/python/cudf/cudf/tests/test_array_function.py @@ -67,6 +67,8 @@ def test_array_func_cudf_series(np_ar, func): lambda x: np.sum(x, axis=0), lambda x: np.var(x, ddof=1), lambda x: np.dot(x, x.transpose()), + lambda x: np.all(x), + lambda x: np.any(x), ], ) def test_array_func_cudf_dataframe(pd_df, func): From d656729a2a675d4dfa3c0231a86e3bafdf42b92e Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Tue, 8 Aug 2023 14:00:48 -0500 Subject: [PATCH 07/11] Update dataframe.py --- python/cudf/cudf/core/dataframe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 40d177b68fe..eea5764ef8a 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -1334,7 +1334,7 @@ def __array_function__(self, func, types, args, kwargs): try: if func.__name__ in {"any", "all"}: - # Numpy default for `axis` if + # Numpy default for `axis` is # different from `cudf`/`pandas` # hence need this special handling. kwargs.setdefault("axis", None) From 44c5f91b2eee3d38f34a8235bb656420e2e52a9e Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Tue, 8 Aug 2023 16:26:43 -0500 Subject: [PATCH 08/11] Apply suggestions from code review Co-authored-by: Bradley Dice --- python/cudf/cudf/core/dataframe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index eea5764ef8a..cb200372fcc 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -1334,7 +1334,7 @@ def __array_function__(self, func, types, args, kwargs): try: if func.__name__ in {"any", "all"}: - # Numpy default for `axis` is + # NumPy default for `axis` is # different from `cudf`/`pandas` # hence need this special handling. kwargs.setdefault("axis", None) From a65e0063527509ad34da958ec3643963112716e7 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 15:08:31 -0700 Subject: [PATCH 09/11] address reviews --- python/cudf/cudf/core/frame.py | 17 ++--------------- python/cudf/cudf/tests/test_array_function.py | 3 +++ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index b281446b321..69757fe900d 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -2090,24 +2090,11 @@ def product( b 5040 dtype: int64 """ - if axis in {no_default, None}: - if axis is None: - # Do not remove until pandas 3.0 support is added. - warnings.warn( - f"In a future version, {type(self).__name__}" - f".product(axis=None) will return a scalar product over " - "the entire DataFrame. To retain the old behavior, " - f"use '{type(self).__name__}.product(axis=0)' or " - f"just '{type(self)}.product()'", - FutureWarning, - ) - axis = 0 - else: - axis = self._get_axis_from_axis_arg(axis) + return self._reduce( # cuDF columns use "product" as the op name, but cupy uses "prod" # and we need cupy if axis == 1. - "product" if axis == 0 else "prod", + "prod" if axis in {1, "columns"} else "product", axis=axis, skipna=skipna, dtype=dtype, diff --git a/python/cudf/cudf/tests/test_array_function.py b/python/cudf/cudf/tests/test_array_function.py index 64fa0c2bdba..758a8cbb535 100644 --- a/python/cudf/cudf/tests/test_array_function.py +++ b/python/cudf/cudf/tests/test_array_function.py @@ -69,6 +69,9 @@ def test_array_func_cudf_series(np_ar, func): lambda x: np.dot(x, x.transpose()), lambda x: np.all(x), lambda x: np.any(x), + lambda x: np.product(x), + lambda x: np.product(x, axis=0), + lambda x: np.product(x, axis=1), ], ) def test_array_func_cudf_dataframe(pd_df, func): From 6a749c3be51c15ceece4927bac10f2d17388b31c Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 8 Aug 2023 17:00:48 -0700 Subject: [PATCH 10/11] Add check --- python/cudf/cudf/core/dataframe.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index cb200372fcc..b9564281bd9 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -5922,6 +5922,8 @@ def _scan( *args, **kwargs, ): + if axis is None: + axis = 0 axis = self._get_axis_from_axis_arg(axis) if axis == 0: From 2ebeb2431f309f6297165e04b400fc1578ef26fc Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Tue, 8 Aug 2023 19:01:13 -0500 Subject: [PATCH 11/11] Update python/cudf/cudf/core/dataframe.py Co-authored-by: Bradley Dice --- python/cudf/cudf/core/dataframe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index cb200372fcc..702bc313e1f 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -5912,7 +5912,7 @@ def _reduce( elif axis == 1: return source._apply_cupy_method_axis_1(op, **kwargs) else: - raise ValueError(f"Incorrect value of {axis=} received for {op}") + raise ValueError(f"Invalid value of {axis=} received for {op}") @_cudf_nvtx_annotate def _scan(