-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
DEPR: DataFrame dropna accepting multiple axes #20995
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20995 +/- ##
==========================================
+ Coverage 91.82% 91.82% +<.01%
==========================================
Files 153 153
Lines 49488 49490 +2
==========================================
+ Hits 45443 45445 +2
Misses 4045 4045
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Couple minor callouts on my end
doc/source/whatsnew/v0.23.0.txt
Outdated
@@ -1005,6 +1005,7 @@ Deprecations | |||
- Setting ``PeriodIndex.freq`` (which was not guaranteed to work correctly) is deprecated. Use :meth:`PeriodIndex.asfreq` instead (:issue:`20678`) | |||
- ``Index.get_duplicates()`` is deprecated and will be removed in a future version (:issue:`20239`) | |||
- The previous default behavior of negative indices in ``Categorical.take`` is deprecated. In a future version it will change from meaning missing values to meaning positional indices from the right. The future behavior is consistent with :meth:`Series.take` (:issue:`20664`). | |||
- Passing multiple axes to the ``axis`` parameter in :func: `DataFrame.dropna` has been deprecated and will not be suppoted in a future version (:issue:`20987`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo of "supported"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
pandas/core/frame.py
Outdated
Determine if rows or columns which contain missing values are | ||
removed. | ||
|
||
* 0, or 'index' : Drop rows which contain missing values. | ||
* 1, or 'columns' : Drop columns which contain missing value. | ||
|
||
Pass tuple or list to drop on multiple axes. | ||
deprecated:: 0.23.0: Pass tuple or list to drop on multiple axes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The directive should start with a ".. " here, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
pandas/core/frame.py
Outdated
@@ -4168,14 +4168,14 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None, | |||
|
|||
Parameters | |||
---------- | |||
axis : {0 or 'index', 1 or 'columns'}, or tuple/list thereof | |||
axis : {0 or 'index', 1 or 'columns'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the standard for this is axis : {0 or ‘index’, 1 or ‘columns’, None}, default None
See end of pandas docstring guide section on Parameters:
https://python-sprints.github.io/pandas/guide/pandas_docstring.html#section-3-parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the default option here. dropna
, however, does not support None
as an input to axis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm if that's the case then just go with axis : {0 or 'index', 1 or 'columns'}, default 0
. That's what I see everywhere else in the code anyway
@datapythonista - something we should update in the docstring standard?
Thanks for the quick review @WillAyd! Resolved the comments above. |
thanks @kunalgosar and @WillAyd |
Deprecates multiple axes passing to
dropna
.I added the whatsnew to 0.23.0 for now, I can move this to 0.24.0 later if preferred once the whatsnew doc is created.
git diff upstream/master -u -- "*.py" | flake8 --diff