Skip to content

Commit 4f85eb8

Browse files
authored
API: drop kwargs from Series.dropna, add explicit how parameter (#29388)
1 parent aa0f138 commit 4f85eb8

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

doc/source/whatsnew/v1.0.0.rst

+2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ Other API changes
192192
Now, pandas custom formatters will only be applied to plots created by pandas, through :meth:`~DataFrame.plot`.
193193
Previously, pandas' formatters would be applied to all plots created *after* a :meth:`~DataFrame.plot`.
194194
See :ref:`units registration <whatsnew_1000.matplotlib_units>` for more.
195+
- :meth:`Series.dropna` has dropped its ``**kwargs`` argument in favor of a single ``how`` parameter.
196+
Supplying anything else than ``how`` to ``**kwargs`` raised a ``TypeError`` previously (:issue:`29388`)
195197
-
196198

197199

pandas/core/series.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -4595,7 +4595,7 @@ def notna(self):
45954595
def notnull(self):
45964596
return super().notnull()
45974597

4598-
def dropna(self, axis=0, inplace=False, **kwargs):
4598+
def dropna(self, axis=0, inplace=False, how=None):
45994599
"""
46004600
Return a new Series with missing values removed.
46014601
@@ -4608,8 +4608,8 @@ def dropna(self, axis=0, inplace=False, **kwargs):
46084608
There is only one axis to drop values from.
46094609
inplace : bool, default False
46104610
If True, do operation inplace and return None.
4611-
**kwargs
4612-
Not in use.
4611+
how : str, optional
4612+
Not in use. Kept for compatibility.
46134613
46144614
Returns
46154615
-------
@@ -4667,12 +4667,6 @@ def dropna(self, axis=0, inplace=False, **kwargs):
46674667
dtype: object
46684668
"""
46694669
inplace = validate_bool_kwarg(inplace, "inplace")
4670-
kwargs.pop("how", None)
4671-
if kwargs:
4672-
raise TypeError(
4673-
"dropna() got an unexpected keyword "
4674-
'argument "{0}"'.format(list(kwargs.keys())[0])
4675-
)
46764670
# Validate the axis parameter
46774671
self._get_axis_number(axis or 0)
46784672

0 commit comments

Comments
 (0)