Skip to content

DEPR: DateOffset args don't end in 's' #36660

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

Closed
wants to merge 9 commits into from
Closed

DEPR: DateOffset args don't end in 's' #36660

wants to merge 9 commits into from

Conversation

GYHHAHA
Copy link
Contributor

@GYHHAHA GYHHAHA commented Sep 26, 2020

Make deprecation DateOffset args don't end in 's'.

Mentioned here

also raise for nanosecond(s) argument in DateOffset
@GYHHAHA GYHHAHA changed the title deprecate DateOffset args don't end in 's' DEPR: DateOffset args don't end in 's' Sep 26, 2020
@rhshadrach rhshadrach added Deprecate Functionality to remove in pandas Frequency DateOffsets labels Sep 26, 2020
Copy link
Member

@arw2019 arw2019 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @GYHHAHA

we might want to test for this. Are there existing test that will emit the warning, for example?

We'll also need a whatsnew note (1.2 I think) under Deprecations

if any(not k.endswith('s') for k in kwds_no_nanos):
if 'weekday' not in kwds_no_nanos:
warnings.warn(
"The DateOffset arguments that do not end in 's' replace "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write Use of Date Offset arguments that do not end with 's' overwrites the offset instead of incrementing it. These arguments are deprecated now and slated for removal in a future version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better. I will make the change.

@GYHHAHA
Copy link
Contributor Author

GYHHAHA commented Oct 2, 2020

Test1:

pandas/tests/io/generate_legacy_storage_files.py:300: in create_pickle_data
    data = create_data()
pandas/tests/io/generate_legacy_storage_files.py:262: in create_data
    "DateOffset_h_ns": DateOffset(hour=6, nanoseconds=5824),
pandas/_libs/tslibs/offsets.pyx:976: in pandas._libs.tslibs.offsets.RelativeDeltaOffset.__init__
    off, use_rd = _determine_offset(kwds)

Test2:

test_dt64arr_add_sub_DateOffsets from pandas.tests.arithmetic.test_datetime64.TestDatetime64DateOffsetArithmetic

Test3:

pandas/tests/tseries/offsets/test_offsets.py:4196: in _test_all_offsets
    self._test_offset(offset_name=name, offset_n=n, **kwds)
pandas/tests/tseries/offsets/test_offsets.py:4199: in _test_offset
    offset = DateOffset(**{offset_name: offset_n})
pandas/_libs/tslibs/offsets.pyx:976: in pandas._libs.tslibs.offsets.RelativeDeltaOffset.__init__
    off, use_rd = _determine_offset(kwds)

Test4 (kwd on argument doesn't end with 's'):

    @pytest.mark.parametrize("kwd", sorted(liboffsets._relativedelta_kwds))
    def test_valid_relativedelta_kwargs(kwd):
         # Check that all the arguments specified in liboffsets._relativedelta_kwds
         # are in fact valid relativedelta keyword args
         DateOffset(**{kwd: 1})

I think these are test relating to this. But I'm not very familiar to handle them. @arw2019

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2020

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Nov 2, 2020
@arw2019
Copy link
Member

arw2019 commented Nov 4, 2020

@GYAHHA sorry for not responding here. Can you rebase again and will take another look at test failures

@arw2019 arw2019 added Needs Review and removed Stale labels Nov 4, 2020
@jreback
Copy link
Contributor

jreback commented Jan 1, 2021

@GYHHAHA reviving this. I think we should do it. likely need to put assert_produces_warning(FutureWarning) around any related tests to get this to pass. move the note to 1.3

@GYHHAHA
Copy link
Contributor Author

GYHHAHA commented Jan 2, 2021

ok, I will take this.

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Feb 12, 2021
@mroeschke
Copy link
Member

Thanks for the PR, but it appears to have gotten stale. Going to close for now but let us know if you can merge master and update and we'd be happy to reopen.

@mroeschke mroeschke closed this Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Frequency DateOffsets Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants