Skip to content

Commit

Permalink
API: drop kwargs from Series.dropna, add explicit how parameter (pa…
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored Nov 4, 2019
1 parent aa0f138 commit 4f85eb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
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
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

0 comments on commit 4f85eb8

Please sign in to comment.