File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -3929,7 +3929,7 @@ def ewm(
3929
3929
... }
3930
3930
... )
3931
3931
>>> df
3932
- Class Value
3932
+ Class Value
3933
3933
0 A 10
3934
3934
1 A 20
3935
3935
2 A 30
@@ -3938,8 +3938,8 @@ def ewm(
3938
3938
5 B 60
3939
3939
3940
3940
>>> df.groupby("Class").ewm(span=2).mean()
3941
- Value
3942
- Class
3941
+ Value
3942
+ Class
3943
3943
A 0 10.000000
3944
3944
1 17.500000
3945
3945
2 26.153846
@@ -3948,24 +3948,24 @@ def ewm(
3948
3948
5 56.153846
3949
3949
3950
3950
>>> df.groupby("Class").ewm(alpha=0.5, adjust=False).mean()
3951
- Value
3952
- Class
3953
- A 0 10.000000
3954
- 1 15.000000
3955
- 2 22.500000
3956
- B 3 40.000000
3957
- 4 45.000000
3958
- 5 52.500000
3951
+ Value
3952
+ Class
3953
+ A 0 10.0
3954
+ 1 15.0
3955
+ 2 22.5
3956
+ B 3 40.0
3957
+ 4 45.0
3958
+ 5 52.5
3959
3959
3960
3960
>>> df.groupby("Class").ewm(com=1.0, min_periods=1).std()
3961
3961
Value
3962
- Class
3963
- A 0 0.000000
3964
- 1 7.500000
3965
- 2 10.606602
3966
- B 3 0.000000
3967
- 4 7.500000
3968
- 5 10.606602
3962
+ Class
3963
+ A 0 NaN
3964
+ 1 7.071068
3965
+ 2 9.636241
3966
+ B 3 NaN
3967
+ 4 7.071068
3968
+ 5 9.636241
3969
3969
"""
3970
3970
3971
3971
from pandas .core .window import ExponentialMovingWindowGroupby
You can’t perform that action at this time.
0 commit comments