Skip to content

Commit 2f26644

Browse files
DEPR: Deprecate passing positional arguments in {DataFrame,Series}.groupby (except by and level) (#62102)
Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 419d5f1 commit 2f26644

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ Other Deprecations
649649
- Deprecated ``pd.core.internals.api.maybe_infer_ndim`` (:issue:`40226`)
650650
- Deprecated allowing constructing or casting to :class:`Categorical` with non-NA values that are not present in specified ``dtype.categories`` (:issue:`40996`)
651651
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.all`, :meth:`DataFrame.min`, :meth:`DataFrame.max`, :meth:`DataFrame.sum`, :meth:`DataFrame.prod`, :meth:`DataFrame.mean`, :meth:`DataFrame.median`, :meth:`DataFrame.sem`, :meth:`DataFrame.var`, :meth:`DataFrame.std`, :meth:`DataFrame.skew`, :meth:`DataFrame.kurt`, :meth:`Series.all`, :meth:`Series.min`, :meth:`Series.max`, :meth:`Series.sum`, :meth:`Series.prod`, :meth:`Series.mean`, :meth:`Series.median`, :meth:`Series.sem`, :meth:`Series.var`, :meth:`Series.std`, :meth:`Series.skew`, and :meth:`Series.kurt`. (:issue:`57087`)
652+
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.groupby` and :meth:`Series.groupby` except ``by`` and ``level``. (:issue:`62102`)
652653
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except ``buf``. (:issue:`57280`)
653654
- Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except ``buf``. (:issue:`57280`)
654655
- Deprecated behavior of :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupBy.groups`, in a future version ``groups`` by one element list will return tuple instead of scalar. (:issue:`58858`)

pandas/core/frame.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9374,6 +9374,9 @@ def update(
93749374
)
93759375
)
93769376
@Appender(_shared_docs["groupby"] % _shared_doc_kwargs)
9377+
@deprecate_nonkeyword_arguments(
9378+
Pandas4Warning, allowed_args=["self", "by", "level"], name="groupby"
9379+
)
93779380
def groupby(
93789381
self,
93799382
by=None,

pandas/core/series.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,9 @@ def _set_name(
19611961
)
19621962
)
19631963
@Appender(_shared_docs["groupby"] % _shared_doc_kwargs)
1964+
@deprecate_nonkeyword_arguments(
1965+
Pandas4Warning, allowed_args=["self", "by", "level"], name="groupby"
1966+
)
19641967
def groupby(
19651968
self,
19661969
by=None,

0 commit comments

Comments
 (0)