We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
on
1 parent 113bdb3 commit e17a7f8Copy full SHA for e17a7f8
pandas/core/window/rolling.py
@@ -1110,6 +1110,29 @@ class Window(BaseWindow):
1110
2 2.958621
1111
3 NaN
1112
4 NaN
1113
+
1114
+ **on**
1115
1116
+ Rolling sum with a window length of 2 days.
1117
1118
+ >>> df = pd.DataFrame({
1119
+ ... 'A': [pd.to_datetime('2020-01-01'),
1120
+ ... pd.to_datetime('2020-01-01'),
1121
+ ... pd.to_datetime('2020-01-02'),],
1122
+ ... 'B': [1, 2, 3], },
1123
+ ... index=pd.date_range('2020', periods=3))
1124
1125
+ >>> df
1126
+ A B
1127
+ 2020-01-01 2020-01-01 1
1128
+ 2020-01-02 2020-01-01 2
1129
+ 2020-01-03 2020-01-02 3
1130
1131
+ >>> df.rolling('2D', on='A').sum()
1132
1133
+ 2020-01-01 2020-01-01 1.0
1134
+ 2020-01-02 2020-01-01 3.0
1135
+ 2020-01-03 2020-01-02 6.0
1136
"""
1137
1138
_attributes = [
0 commit comments