@@ -152,7 +152,6 @@ class providing the base-class of operations.
152
152
from pandas .core .indexers .objects import BaseIndexer
153
153
from pandas .core .resample import Resampler
154
154
from pandas .core .window import (
155
- ExpandingGroupby ,
156
155
ExponentialMovingWindowGroupby ,
157
156
RollingGroupby ,
158
157
)
@@ -3802,27 +3801,6 @@ def rolling(
3802
3801
_as_index = self .as_index ,
3803
3802
)
3804
3803
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
-
3826
3804
@final
3827
3805
@Substitution (name = "groupby" )
3828
3806
@Appender (_common_see_also )
@@ -3832,53 +3810,41 @@ def ewm(self, *args, **kwargs) -> ExponentialMovingWindowGroupby:
3832
3810
3833
3811
Parameters
3834
3812
----------
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
3869
3828
3870
3829
Returns
3871
3830
-------
3872
3831
pandas.api.typing.ExponentialMovingWindowGroupby
3873
3832
Return a new grouper with exponential moving window capabilities.
3874
3833
3834
+ See Also
3835
+ --------
3836
+ pandas.DataFrame.ewm : Exponential weighted function for DataFrame.
3837
+ pandas.Series.ewm : Exponential weighted function for Series.
3838
+
3875
3839
Notes
3876
3840
-----
3877
3841
Each group is treated independently, and the exponential weighted calculations
3878
3842
are applied separately to each group.
3843
+
3879
3844
When ``adjust=True``, weighted averages are calculated using weights
3880
3845
:math:`w_i = (1-\\ alpha)^i` where :math:`i` is the number of periods from the
3881
3846
observations being weighted to the current period.
3847
+
3882
3848
When ``adjust=False``, the calculation follows the recursive formula:
3883
3849
:math:`y_t = (1 - \\ alpha) y_{t-1} + \\ alpha x_t`.
3884
3850
0 commit comments