Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Raise NotImplementedError for axis=1 in rank #8347

Merged
merged 1 commit into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions python/cudf/cudf/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
Expand Down