Skip to content

DOC: Add documentation for groupby.ewm() #61268

Closed
@arthurlw

Description

@arthurlw

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.ewm(), even though it exists in API, and Docstring can be greatly improved.

Similar to: #61254

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
>>> ewm_mean = (df.groupby("Class").ewm(span=2).mean().reset_index(drop=True))
>>> ewm_mean
   Value
0  10.000000
1  17.500000
2  26.153846
3  40.000000
4  47.500000
5  56.153846

Suggested fix for documentation

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

Improve groupby.ewm() function Docstring

Metadata

Metadata

Assignees

Labels

DocsNeeds TriageIssue that has not been reviewed by a pandas team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions