@@ -147,7 +147,9 @@ def func(arg, window, min_periods=None):
147
147
return func
148
148
149
149
150
- class _Window (ShallowMixin , SelectionMixin ):
150
+ class BaseWindow (ShallowMixin , SelectionMixin ):
151
+ """Provides utilities for performing windowing operations."""
152
+
151
153
_attributes : List [str ] = [
152
154
"window" ,
153
155
"min_periods" ,
@@ -184,10 +186,6 @@ def __init__(
184
186
self .axis = obj ._get_axis_number (axis ) if axis is not None else None
185
187
self .validate ()
186
188
187
- @property
188
- def _constructor (self ):
189
- return Window
190
-
191
189
@property
192
190
def is_datetimelike (self ) -> Optional [bool ]:
193
191
return None
@@ -862,7 +860,7 @@ def aggregate(self, func, *args, **kwargs):
862
860
)
863
861
864
862
865
- class Window (_Window ):
863
+ class Window (BaseWindow ):
866
864
"""
867
865
Provide rolling window calculations.
868
866
@@ -1040,6 +1038,10 @@ class Window(_Window):
1040
1038
2013-01-01 09:00:06 4.0
1041
1039
"""
1042
1040
1041
+ @property
1042
+ def _constructor (self ):
1043
+ return Window
1044
+
1043
1045
def validate (self ):
1044
1046
super ().validate ()
1045
1047
@@ -1220,13 +1222,7 @@ def std(self, ddof=1, *args, **kwargs):
1220
1222
return zsqrt (self .var (ddof = ddof , name = "std" , ** kwargs ))
1221
1223
1222
1224
1223
- class RollingMixin (_Window ):
1224
- @property
1225
- def _constructor (self ):
1226
- return Rolling
1227
-
1228
-
1229
- class RollingAndExpandingMixin (RollingMixin ):
1225
+ class RollingAndExpandingMixin (BaseWindow ):
1230
1226
1231
1227
_shared_docs ["count" ] = dedent (
1232
1228
r"""
@@ -1939,6 +1935,10 @@ def _on(self) -> Index:
1939
1935
"must be a column (of DataFrame), an Index or None"
1940
1936
)
1941
1937
1938
+ @property
1939
+ def _constructor (self ):
1940
+ return Rolling
1941
+
1942
1942
def validate (self ):
1943
1943
super ().validate ()
1944
1944
0 commit comments