@@ -142,6 +142,7 @@ class providing the base-class of operations.
142
142
143
143
if TYPE_CHECKING :
144
144
from pandas ._libs .tslibs import BaseOffset
145
+ from pandas ._libs .tslibs .timedeltas import Timedelta
145
146
from pandas ._typing import (
146
147
Any ,
147
148
Concatenate ,
@@ -3872,39 +3873,54 @@ def expanding(self, *args, **kwargs) -> ExpandingGroupby:
3872
3873
)
3873
3874
3874
3875
@final
3875
- def ewm (self , * args , ** kwargs ) -> ExponentialMovingWindowGroupby :
3876
+ def ewm (
3877
+ self ,
3878
+ com : float | None = None ,
3879
+ span : float | None = None ,
3880
+ halflife : float | str | Timedelta | None = None ,
3881
+ alpha : float | None = None ,
3882
+ min_periods : int | None = 0 ,
3883
+ adjust : bool = True ,
3884
+ ignore_na : bool = False ,
3885
+ times : np .ndarray | Series | None = None ,
3886
+ method : str = "single" ,
3887
+ ) -> ExponentialMovingWindowGroupby :
3876
3888
"""
3877
3889
Return an ewm grouper, providing ewm functionality per group.
3878
3890
3879
3891
Parameters
3880
3892
----------
3881
- *args : tuple
3882
- Positional arguments passed to the EWM window constructor.
3883
- **kwargs : dict
3884
- Keyword arguments passed to the EWM window constructor, such as:
3885
-
3886
- com : float, optional
3887
- Specify decay in terms of center of mass.
3888
- ``span``, ``halflife``, and ``alpha`` are alternative ways to specify
3889
- decay.
3890
- span : float, optional
3891
- Specify decay in terms of span.
3892
- halflife : float, optional
3893
- Specify decay in terms of half-life.
3894
- alpha : float, optional
3895
- Specify smoothing factor directly.
3896
- min_periods : int, default 0
3897
- Minimum number of observations in the window required to have a value;
3898
- otherwise, result is ``np.nan``.
3899
- adjust : bool, default True
3900
- Divide by decaying adjustment factor to account for imbalance in
3901
- relative weights.
3902
- ignore_na : bool, default False
3903
- Ignore missing values when calculating weights.
3904
- times : str or array-like of datetime64, optional
3905
- Times corresponding to the observations.
3906
- axis : {0 or 'index', 1 or 'columns'}, default 0
3907
- Axis along which the EWM function is applied.
3893
+ com : float, optional
3894
+ Specify decay in terms of center of mass.
3895
+ Alternative to ``span``, ``halflife``, and ``alpha``.
3896
+
3897
+ span : float, optional
3898
+ Specify decay in terms of span.
3899
+
3900
+ halflife : float, str, or Timedelta, optional
3901
+ Specify decay in terms of half-life.
3902
+
3903
+ alpha : float, optional
3904
+ Specify smoothing factor directly.
3905
+
3906
+ min_periods : int, default 0
3907
+ Minimum number of observations in the window required to have a value;
3908
+ otherwise, result is ``np.nan``.
3909
+
3910
+ adjust : bool, default True
3911
+ Divide by decaying adjustment factor to account for imbalance in
3912
+ relative weights.
3913
+
3914
+ ignore_na : bool, default False
3915
+ Ignore missing values when calculating weights.
3916
+
3917
+ times : str or array-like of datetime64, optional
3918
+ Times corresponding to the observations.
3919
+
3920
+ method : {'single', 'table'}, default 'single'
3921
+ Execute the operation per group independently (``'single'``) or over the
3922
+ entire object before regrouping (``'table'``). Only applicable to
3923
+ ``mean()``, and only when using ``engine='numba'``.
3908
3924
3909
3925
Returns
3910
3926
-------
@@ -3950,9 +3966,16 @@ def ewm(self, *args, **kwargs) -> ExponentialMovingWindowGroupby:
3950
3966
3951
3967
return ExponentialMovingWindowGroupby (
3952
3968
self ._selected_obj ,
3953
- * args ,
3969
+ com = com ,
3970
+ span = span ,
3971
+ halflife = halflife ,
3972
+ alpha = alpha ,
3973
+ min_periods = min_periods ,
3974
+ adjust = adjust ,
3975
+ ignore_na = ignore_na ,
3976
+ times = times ,
3977
+ method = method ,
3954
3978
_grouper = self ._grouper ,
3955
- ** kwargs ,
3956
3979
)
3957
3980
3958
3981
@final
0 commit comments