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 non-keyword arguments in drop #41486

Merged

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented May 15, 2021

@MarcoGorelli MarcoGorelli added the Deprecate Functionality to remove in pandas label May 15, 2021
@@ -647,6 +647,7 @@ Deprecations
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`)
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`)
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`)
- Deprecated passing arguments (apart from ``labels``) as positional in :meth:`DataFrame.drop` and :meth:`Series.drop` (:issue:`41485`)
Copy link
Member

Choose a reason for hiding this comment

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

as per other comments, we could consider deprecating some compatibility parameters on Series at the same time.

r"arguments 'self' and 'labels' will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
df.drop("a", 1)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add an assert that the result is still the same as df.drop("a", axis=1) (outside of the assert_produces_warning context)

r"arguments 'self' and 'labels' will be keyword-only"
)
with tm.assert_produces_warning(FutureWarning, match=msg):
ser.drop(1, 0)
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@jorisvandenbossche jorisvandenbossche changed the title deprecate non-keyword arguments in drop Deprecate non-keyword arguments in drop May 17, 2021
@MarcoGorelli MarcoGorelli marked this pull request as draft May 18, 2021 08:14
@jreback
Copy link
Contributor

jreback commented May 26, 2021

FYI @MarcoGorelli a way to avoid the conflicts as we merge is to put the notes slightly randomly in the whatsnew deprecation section (e.g. not one after the other) and/or put blank lines to separate the conflicts, but nbd.

@jreback
Copy link
Contributor

jreback commented May 27, 2021

can u rebase

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @MarcoGorelli lgtm pending green.

maybe could also consider (not in this PR) doing the same for Index (although multiindex is an issue as it doesn't have the same signature)

@simonjayhawkins simonjayhawkins merged commit 22252c9 into pandas-dev:master May 27, 2021
@MarcoGorelli MarcoGorelli deleted the deprecate-nonkeyword-args-drop branch May 27, 2021 12:23
@MarcoGorelli
Copy link
Member Author

Thanks @simonjayhawkins - Index.drop doesn't have inplace and the return type is always the same so I didn't prioritise it here

TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
devRoemer added a commit to SamhammerAG/ai-data-preprocessing-queue that referenced this pull request Apr 27, 2023
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.

4 participants