From 5e20f7cd4639e2d8d162ad9c730f1db08252bacd Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 25 May 2021 07:23:58 -0700 Subject: [PATCH] raise error for axis=1 --- python/cudf/cudf/core/frame.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index 1c6c1ed85e6..4ea3decdc50 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -26,13 +26,13 @@ ) from cudf.core.join import merge from cudf.utils.dtypes import ( + find_common_type, is_categorical_dtype, is_column_like, is_decimal_dtype, is_numerical_dtype, is_scalar, min_scalar_type, - find_common_type, ) T = TypeVar("T", bound="Frame") @@ -1470,7 +1470,7 @@ def rank( Parameters ---------- - axis : {0 or 'index', 1 or 'columns'}, default 0 + axis : {0 or 'index'}, default 0 Index to direct ranking. method : {'average', 'min', 'max', 'first', 'dense'}, default 'average' How to rank the group of records that have the same value @@ -1500,12 +1500,19 @@ def rank( """ if method not in {"average", "min", "max", "first", "dense"}: raise KeyError(method) + method_enum = libcudf.sort.RankMethod[method.upper()] if na_option not in {"keep", "top", "bottom"}: raise ValueError( "na_option must be one of 'keep', 'top', or 'bottom'" ) + if axis not in (0, "index"): + raise NotImplementedError( + f"axis must be `0`/`index`, " + f"axis={axis} is not yet supported in rank" + ) + source = self if numeric_only: numeric_cols = (