Skip to content

API: drop kwargs from Series.dropna, add explicit how parameter #29388

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ Other API changes
Now, pandas custom formatters will only be applied to plots created by pandas, through :meth:`~DataFrame.plot`.
Previously, pandas' formatters would be applied to all plots created *after* a :meth:`~DataFrame.plot`.
See :ref:`units registration <whatsnew_1000.matplotlib_units>` for more.
- :meth:`Series.dropna` has dropped its ``**kwargs`` argument in favor of a single ``how`` parameter.
Supplying anything else than ``how`` to ``**kwargs`` raised a ``TypeError`` previously (:issue:`29388`)
-


Expand Down
12 changes: 3 additions & 9 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4595,7 +4595,7 @@ def notna(self):
def notnull(self):
return super().notnull()

def dropna(self, axis=0, inplace=False, **kwargs):
def dropna(self, axis=0, inplace=False, how=None):
"""
Return a new Series with missing values removed.

Expand All @@ -4608,8 +4608,8 @@ def dropna(self, axis=0, inplace=False, **kwargs):
There is only one axis to drop values from.
inplace : bool, default False
If True, do operation inplace and return None.
**kwargs
Not in use.
how : str, optional
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe mention this is for compatibility

Not in use. Kept for compatibility.

Returns
-------
Expand Down Expand Up @@ -4667,12 +4667,6 @@ def dropna(self, axis=0, inplace=False, **kwargs):
dtype: object
"""
inplace = validate_bool_kwarg(inplace, "inplace")
kwargs.pop("how", None)
if kwargs:
raise TypeError(
"dropna() got an unexpected keyword "
'argument "{0}"'.format(list(kwargs.keys())[0])
)
# Validate the axis parameter
self._get_axis_number(axis or 0)

Expand Down