Skip to content

Commit ef2d9dd

Browse files
committed
docstring checks
1 parent 4b1b051 commit ef2d9dd

File tree

1 file changed

+22
-56
lines changed

1 file changed

+22
-56
lines changed

pandas/core/groupby/groupby.py

+22-56
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ class providing the base-class of operations.
152152
from pandas.core.indexers.objects import BaseIndexer
153153
from pandas.core.resample import Resampler
154154
from pandas.core.window import (
155-
ExpandingGroupby,
156155
ExponentialMovingWindowGroupby,
157156
RollingGroupby,
158157
)
@@ -3802,27 +3801,6 @@ def rolling(
38023801
_as_index=self.as_index,
38033802
)
38043803

3805-
@final
3806-
@Substitution(name="groupby")
3807-
@Appender(_common_see_also)
3808-
def expanding(self, *args, **kwargs) -> ExpandingGroupby:
3809-
"""
3810-
Return an expanding grouper, providing expanding
3811-
functionality per group.
3812-
3813-
Returns
3814-
-------
3815-
pandas.api.typing.ExpandingGroupby
3816-
"""
3817-
from pandas.core.window import ExpandingGroupby
3818-
3819-
return ExpandingGroupby(
3820-
self._selected_obj,
3821-
*args,
3822-
_grouper=self._grouper,
3823-
**kwargs,
3824-
)
3825-
38263804
@final
38273805
@Substitution(name="groupby")
38283806
@Appender(_common_see_also)
@@ -3832,53 +3810,41 @@ def ewm(self, *args, **kwargs) -> ExponentialMovingWindowGroupby:
38323810
38333811
Parameters
38343812
----------
3835-
com : float, optional
3836-
Specify decay in terms of center of mass:
3837-
:math:`\\alpha = 1 / (1 + com)` for :math:`com \\geq 0`.
3838-
One and only one of ``com``, ``span``, ``halflife``, or ``alpha`` must
3839-
be provided.
3840-
span : float, optional
3841-
Specify decay in terms of span:
3842-
:math:`\\alpha = 2 / (span + 1)` for :math:`span \\geq 1`.
3843-
One and only one of ``com``, ``span``, ``halflife``, or ``alpha`` must
3844-
be provided.
3845-
halflife : float, optional
3846-
Specify decay in terms of half-life:
3847-
:math:`\\alpha = 1 - \\exp(-\\ln(2) / halflife)` for :math:`halflife > 0`.
3848-
One and only one of ``com``, ``span``, ``halflife``, or ``alpha`` must
3849-
be provided.
3850-
alpha : float, optional
3851-
Specify the smoothing factor :math:`\\alpha` directly,
3852-
where :math:`0 < \\alpha \\leq 1`.
3853-
One and only one of ``com``, ``span``, ``halflife``, or ``alpha`` must
3854-
be provided.
3855-
min_periods : int, default 0
3856-
Minimum number of observations in window required to have a value;
3857-
otherwise, result is ``np.nan``.
3858-
adjust : bool, default True
3859-
Divide by decaying adjustment factor in beginning periods to account
3860-
for imbalance in relative weightings (viewing EWMA as a moving average).
3861-
ignore_na : bool, default False
3862-
If ``True``, missing values are ignored in the calculation.
3863-
If ``False``, missing values are treated as missing.
3864-
axis : {0 or 'index', 1 or 'columns'}, default 0
3865-
The axis to use. The value 0 identifies the rows, and 1 identifies the
3866-
columns.
3867-
*args, **kwargs
3868-
Additional arguments and keyword arguments passed to the function.
3813+
*args
3814+
Arguments to be passed to
3815+
:meth:`~pandas.core.window.ExponentialMovingWindow`.
3816+
**kwargs
3817+
Keyword arguments to be passed to
3818+
:meth:`~pandas.core.window.ExponentialMovingWindow`.
3819+
These can include:
3820+
- com : float, optional
3821+
- span : float, optional
3822+
- halflife : float, optional
3823+
- alpha : float, optional
3824+
- min_periods : int, default 0
3825+
- adjust : bool, default True
3826+
- ignore_na : bool, default False
3827+
- axis : {0 or 'index', 1 or 'columns'}, default 0
38693828
38703829
Returns
38713830
-------
38723831
pandas.api.typing.ExponentialMovingWindowGroupby
38733832
Return a new grouper with exponential moving window capabilities.
38743833
3834+
See Also
3835+
--------
3836+
pandas.DataFrame.ewm : Exponential weighted function for DataFrame.
3837+
pandas.Series.ewm : Exponential weighted function for Series.
3838+
38753839
Notes
38763840
-----
38773841
Each group is treated independently, and the exponential weighted calculations
38783842
are applied separately to each group.
3843+
38793844
When ``adjust=True``, weighted averages are calculated using weights
38803845
:math:`w_i = (1-\\alpha)^i` where :math:`i` is the number of periods from the
38813846
observations being weighted to the current period.
3847+
38823848
When ``adjust=False``, the calculation follows the recursive formula:
38833849
:math:`y_t = (1 - \\alpha) y_{t-1} + \\alpha x_t`.
38843850

0 commit comments

Comments
 (0)