Skip to content

DOC: Add documentation for groupby.expanding() #61254

@olek-osikowicz

Description

@olek-osikowicz

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

"https://pandas.pydata.org/docs/dev/reference/groupby.html"

Documentation problem

There is no reference for DataFrameGroupBy.expanding(), even though it exists in API

E.g. consider working example:

>>> import pandas as pd
>>> pd.__version__
'2.2.3'
>>> data = {"Class": ["A", "A", "A", "B", "B", "B"],"Value": [10, 20, 30, 40, 50, 60],}
>>> df = pd.DataFrame(data)
>>> df
  Class  Value
0     A     10
1     A     20
2     A     30
3     B     40
4     B     50
5     B     60
>>> expanding_mean = df.groupby("Class").expanding().mean().reset_index(drop=True)
>>> expanding_mean
   Value
0   10.0
1   15.0
2   20.0
3   40.0
4   45.0
5   50.0

It's undocumented behaviour

Suggested fix for documentation

Include reference of DataFrameGroupBy.expanding and SeriesGroupBy.expanding, like for DataFrameGroupBy.rolling
and SeriesGroupBy.rolling

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions