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 parameters similar to pandas 2.2 #14984

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions python/cudf/cudf/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,11 @@ def __init__(
raise NotImplementedError("freq is not yet supported")

if unit is not None:
warnings.warn(
"The 'unit' keyword is "
"deprecated and will be removed in a future version. ",
FutureWarning,
)
raise NotImplementedError(
"unit is not yet supported, alternatively "
"dtype parameter is supported"
Expand Down
6 changes: 6 additions & 0 deletions python/cudf/cudf/core/indexed_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,12 @@ def resample(
"""
import cudf.core.resample

if kind is not None:
warnings.warn(
"The 'kind' keyword in is "
"deprecated and will be removed in a future version. ",
FutureWarning,
)
if (axis, convention, kind, loffset, base, origin, offset) != (
0,
"start",
Expand Down
8 changes: 8 additions & 0 deletions python/cudf/cudf/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ def to_datetime(
f"{errors=} is not implemented when arg is not scalar-like"
)

if errors == "ignore":
warnings.warn(
"errors='ignore' is deprecated and will raise in a future version. "
"Use to_datetime without passing `errors` and catch exceptions "
"explicitly instead",
FutureWarning,
)

if infer_datetime_format in {None, False}:
warnings.warn(
"`infer_datetime_format` is deprecated and will "
Expand Down
7 changes: 7 additions & 0 deletions python/cudf/cudf/core/tools/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def to_numeric(arg, errors="raise", downcast=None):

if errors not in {"raise", "ignore", "coerce"}:
raise ValueError("invalid error value specified")
elif errors == "ignore":
warnings.warn(
"errors='ignore' is deprecated and will raise in a future version. "
"Use to_numeric without passing `errors` and catch exceptions "
"explicitly instead",
FutureWarning,
)

if downcast not in {None, "integer", "signed", "unsigned", "float"}:
raise ValueError("invalid downcasting method provided")
Expand Down
5 changes: 5 additions & 0 deletions python/cudf/cudf/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2468,3 +2468,8 @@ def test_datetime_raise_warning(freqstr):
)
with pytest.warns(FutureWarning):
t.dt.ceil(freqstr)


def test_to_datetime_errors_ignore_deprecated():
with pytest.warns(FutureWarning):
cudf.to_datetime("2001-01-01 00:04:45", errors="ignore")
5 changes: 5 additions & 0 deletions python/cudf/cudf/tests/test_numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,8 @@ def test_series_to_numeric_preserve_index_name(klass):
result = cudf.to_numeric(ser)
expected = cudf.Series([1] * 8, index=range(2, 10), name="name")
assert_eq(result, expected)


def test_to_datetime_errors_ignore_deprecated():
with pytest.warns(FutureWarning):
cudf.to_datetime("1", errors="ignore")
Loading