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 passing default args as positional in DataFrame.set_index #41495

Merged

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli added the Deprecate Functionality to remove in pandas label May 15, 2021
@MarcoGorelli MarcoGorelli requested a review from jreback May 16, 2021 09:21
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@simonjayhawkins simonjayhawkins added this to the 1.3 milestone May 17, 2021
@@ -5301,6 +5302,7 @@ def shift(
periods=periods, freq=freq, axis=axis, fill_value=fill_value
)

@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "keys"])
Copy link
Contributor

Choose a reason for hiding this comment

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

do we set the version in other deprecations? I don't think we generally want to, for example what if we delayed this to 3.0 then we'd have to update all of these messages.

Copy link
Member

Choose a reason for hiding this comment

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

(I think in general it is useful information to mention the version when it is going to be removed)

Copy link
Member

Choose a reason for hiding this comment

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

what our deprecation policy does say

Deprecations will only be enforced in major releases. For example, if a behavior is deprecated in pandas 1.2.0, it will continue to work, with a warning, for all releases in the 1.x series. The behavior will change and the deprecation removed in the next major release (2.0.0).

out deprecation policy also says

pandas will introduce deprecations in minor releases.

what our deprecation policy does NOT say is what happens when the deprecation is introduced late in the series and there are no further releases in the series.

so if our next release after 1.3 (where these deprecations are introduced) is 2.0, do we deprecate the behaviour? "Deprecations will only be enforced in major releases." so the next major release is 3.0.

if the next release is 1.4, then OK to deprecate in 2.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would've thought it would be OK to deprecate in 2.0 regardless of whether there's a 1.4 release

If the deprecation is introduced in 1.3.0 (minor release) and then enforced in 2.0 (the next major release), then isn't that inline with the policy?

I don't understand how you got to "so the next major release is 3.0"

Copy link
Contributor

Choose a reason for hiding this comment

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

this is yet another reason we don't want to actually use the version string in the message

in any event we can choose or not to release 1.4 (no depreciations removed ) or just do 2.0 (where all depreciations are removed)

Copy link
Member

Choose a reason for hiding this comment

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

I recall a comment from Joris that we should not expect all users to upgrade to every version and that users could skip versions.

so if we introduce in one version, should we enforce in the next?

# https://github.com/pandas-dev/pandas/issues/41485
df = DataFrame({"a": [1, 2, 3]})
msg = (
r"Starting with Pandas version 2\.0 all arguments of set_index except for "
Copy link
Contributor

Choose a reason for hiding this comment

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

and the comment on the other PRs about the message.

@jorisvandenbossche jorisvandenbossche changed the title deprecate default args as positional in set_index Deprecate passing default args as positional in DataFrame.set_index May 17, 2021
@MarcoGorelli MarcoGorelli marked this pull request as draft May 18, 2021 08:14
@MarcoGorelli MarcoGorelli marked this pull request as ready for review May 19, 2021 20:03
@MarcoGorelli MarcoGorelli force-pushed the deprecate-nonkeyword-args-replace branch from 423b79c to f4da184 Compare May 19, 2021 20:04
@jreback jreback merged commit db980ba into pandas-dev:master May 26, 2021
@MarcoGorelli MarcoGorelli deleted the deprecate-nonkeyword-args-replace branch May 26, 2021 14:14
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants