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

Deprecate various functions that don't need to be defined for Index. #10647

Merged
Merged
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions python/cudf/cudf/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,12 @@ def scatter_by_map(
-------
A list of cudf.DataFrame objects.
"""
if not isinstance(self, cudf.DataFrame):
warnings.warn(
f"{self.__class__}.scatter_by_map is deprecated and will be "
vyasr marked this conversation as resolved.
Show resolved Hide resolved
"removed.",
FutureWarning,
)

# map_index might be a column name or array,
# make it a Column
Expand Down Expand Up @@ -1095,6 +1101,8 @@ def fillna(
elif method == "backfill":
method = "bfill"

# TODO: This logic should be handled in different subclasses since
# different Frames support different types of values.
if isinstance(value, cudf.Series):
value = value.reindex(self._data.names)
elif isinstance(value, cudf.DataFrame):
Expand Down Expand Up @@ -1209,6 +1217,11 @@ def interpolate(
some or all ``NaN`` values

"""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"Index.interpolate is deprecated and will be removed.",
FutureWarning,
)

if method in {"pad", "ffill"} and limit_direction != "forward":
raise ValueError(
Expand Down Expand Up @@ -1320,6 +1333,12 @@ def rank(
same type as caller
Return a Series or DataFrame with data ranks as values.
"""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"Index.rank is deprecated and will be removed.",
FutureWarning,
)

if method not in {"average", "min", "max", "first", "dense"}:
raise KeyError(method)

Expand Down Expand Up @@ -1355,6 +1374,12 @@ def rank(
@_cudf_nvtx_annotate
def shift(self, periods=1, freq=None, axis=0, fill_value=None):
"""Shift values by `periods` positions."""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"Index.shift is deprecated and will be removed.",
FutureWarning,
)

axis = self._get_axis_from_axis_arg(axis)
if axis != 0:
raise ValueError("Only axis=0 is supported.")
Expand Down Expand Up @@ -1747,6 +1772,12 @@ def replace(
3 3 8 d
4 4 9 e
"""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"Index.replace is deprecated and will be removed.",
FutureWarning,
)

if limit is not None:
raise NotImplementedError("limit parameter is not implemented yet")

Expand Down Expand Up @@ -2309,6 +2340,12 @@ def scale(self):
4 0.043478
dtype: float64
"""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"Index.scale is deprecated and will be removed.",
FutureWarning,
)

vmin = self.min()
vmax = self.max()
scaled = (self - vmin) / (vmax - vmin)
Expand Down Expand Up @@ -3357,6 +3394,12 @@ def _scan(self, op, axis=None, skipna=True):
2 6 24
3 10 34
"""
if isinstance(self, cudf.BaseIndex):
warnings.warn(
"This method is deprecated and will be removed.",
vyasr marked this conversation as resolved.
Show resolved Hide resolved
FutureWarning,
)

cast_to_int = op in ("cumsum", "cumprod")
skipna = True if skipna is None else skipna

Expand Down