@@ -141,6 +141,7 @@ class providing the base-class of operations.
141
141
142
142
if TYPE_CHECKING :
143
143
from pandas ._libs .tslibs import BaseOffset
144
+ from pandas ._libs .tslibs .timedeltas import Timedelta
144
145
from pandas ._typing import (
145
146
Any ,
146
147
Concatenate ,
@@ -3866,39 +3867,49 @@ def expanding(self, *args, **kwargs) -> ExpandingGroupby:
3866
3867
)
3867
3868
3868
3869
@final
3869
- def ewm (self , * args , ** kwargs ) -> ExponentialMovingWindowGroupby :
3870
+ def ewm (
3871
+ self ,
3872
+ com : float | None = None ,
3873
+ span : float | None = None ,
3874
+ halflife : float | str | Timedelta | None = None ,
3875
+ alpha : float | None = None ,
3876
+ min_periods : int | None = 0 ,
3877
+ adjust : bool = True ,
3878
+ ignore_na : bool = False ,
3879
+ times : np .ndarray | Series | None = None ,
3880
+ method : str = "single" ,
3881
+ ) -> ExponentialMovingWindowGroupby :
3870
3882
"""
3871
3883
Return an ewm grouper, providing ewm functionality per group.
3872
3884
3873
3885
Parameters
3874
3886
----------
3875
- *args : tuple
3876
- Positional arguments passed to the EWM window constructor.
3877
- **kwargs : dict
3878
- Keyword arguments passed to the EWM window constructor, such as:
3879
-
3880
- com : float, optional
3881
- Specify decay in terms of center of mass.
3882
- ``span``, ``halflife``, and ``alpha`` are alternative ways to specify
3883
- decay.
3884
- span : float, optional
3885
- Specify decay in terms of span.
3886
- halflife : float, optional
3887
- Specify decay in terms of half-life.
3888
- alpha : float, optional
3889
- Specify smoothing factor directly.
3890
- min_periods : int, default 0
3891
- Minimum number of observations in the window required to have a value;
3892
- otherwise, result is ``np.nan``.
3893
- adjust : bool, default True
3894
- Divide by decaying adjustment factor to account for imbalance in
3887
+ com : float, optional
3888
+ Specify decay in terms of center of mass.
3889
+ Alternative to ``span``, ``halflife``, and ``alpha``.
3890
+
3891
+ span : float, optional
3892
+ Specify decay in terms of span.
3893
+
3894
+ halflife : float, str, or Timedelta, optional
3895
+ Specify decay in terms of half-life.
3896
+
3897
+ alpha : float, optional
3898
+ Specify smoothing factor directly.
3899
+
3900
+ min_periods : int, default 0
3901
+ Minimum number of observations in the window required to have a value;
3902
+ otherwise, result is ``np.nan``.
3903
+
3904
+ adjust : bool, default True
3905
+ Divide by decaying adjustment factor to account for imbalance in
3895
3906
relative weights.
3896
- ignore_na : bool, default False
3897
- Ignore missing values when calculating weights.
3898
- times : str or array-like of datetime64, optional
3899
- Times corresponding to the observations.
3900
- axis : {0 or 'index', 1 or 'columns'}, default 0
3901
- Axis along which the EWM function is applied .
3907
+
3908
+ ignore_na : bool, default False
3909
+ Ignore missing values when calculating weights.
3910
+
3911
+ times : str or array-like of datetime64, optional
3912
+ Times corresponding to the observations .
3902
3913
3903
3914
Returns
3904
3915
-------
@@ -3944,9 +3955,16 @@ def ewm(self, *args, **kwargs) -> ExponentialMovingWindowGroupby:
3944
3955
3945
3956
return ExponentialMovingWindowGroupby (
3946
3957
self ._selected_obj ,
3947
- * args ,
3958
+ com = com ,
3959
+ span = span ,
3960
+ halflife = halflife ,
3961
+ alpha = alpha ,
3962
+ min_periods = min_periods ,
3963
+ adjust = adjust ,
3964
+ ignore_na = ignore_na ,
3965
+ times = times ,
3966
+ method = method ,
3948
3967
_grouper = self ._grouper ,
3949
- ** kwargs ,
3950
3968
)
3951
3969
3952
3970
@final
0 commit comments