Skip to content

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

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
1 task done
olek-osikowicz opened this issue Apr 8, 2025 · 2 comments · Fixed by #61274
Closed
1 task done

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

olek-osikowicz opened this issue Apr 8, 2025 · 2 comments · Fixed by #61274
Assignees
Labels
Docs Groupby Window rolling, ewma, expanding

Comments

@olek-osikowicz
Copy link

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

@olek-osikowicz olek-osikowicz added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 8, 2025
@rhshadrach
Copy link
Member

Thanks for the report. Agreed this should be added. While adding it to the API docs will make it show up, it looks like the current docstring should also be greatly improved as well.

PRs to improve are welcome!

@rhshadrach rhshadrach added Groupby Window rolling, ewma, expanding and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 8, 2025
@arthurlw
Copy link
Contributor

arthurlw commented Apr 9, 2025

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Groupby Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants