Skip to content

DEPR: positional arguments in favor of keyword arguments #48735

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

Closed
Show file tree
Hide file tree
Changes from 12 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
5 changes: 2 additions & 3 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ Other API changes

Deprecations
~~~~~~~~~~~~
-
-


.. ---------------------------------------------------------------------------
.. _whatsnew_200.performance:
Expand Down Expand Up @@ -226,7 +225,6 @@ Indexing
- Bug in :meth:`DataFrame.reindex` casting dtype to ``object`` when :class:`DataFrame` has single extension array column when re-indexing ``columns`` and ``index`` (:issue:`48190`)
- Bug in :func:`~DataFrame.describe` when formatting percentiles in the resulting index showed more decimals than needed (:issue:`46362`)
- Bug in :meth:`DataFrame.compare` does not recognize differences when comparing ``NA`` with value in nullable dtypes (:issue:`48939`)
-

Missing
^^^^^^^
Expand Down Expand Up @@ -301,6 +299,7 @@ Metadata

Other
^^^^^
- Add future warnings in :meth:`DataFrameGroupBy.fillna` and :meth:`SeriesGroupBy.fillna` allowing only keyword arguments to be passed except ``value`` (:issue:`48395`)
Copy link
Member

Choose a reason for hiding this comment

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

move to section starting on L564 and reword like the others, so maybe "Deprecated...." instead of mentioning FutureWarning.


.. ***DO NOT USE THIS SECTION***

Expand Down
12 changes: 12 additions & 0 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,12 @@ def fillna(
5 NaN
dtype: float64
"""
warnings.warn(
'In a future version of pandas, all the parameters except "value" '
"of SeriesGroupBy.fillna have to be keyword-only.",
FutureWarning,
stacklevel=find_stack_level(),
)
result = self._op_via_apply(
"fillna",
value=value,
Expand Down Expand Up @@ -2267,6 +2273,12 @@ def fillna(
3 3.0 NaN 2.0
4 3.0 NaN NaN
"""
warnings.warn(
'In a future version of pandas, all the parameters except "value" '
"of DataFrameGroupBy.fillna have to be keyword-only.",
FutureWarning,
stacklevel=find_stack_level(),
)
result = self._op_via_apply(
"fillna",
value=value,
Expand Down