Provide rolling window calculations. Parameters ---------- window : int, timedelta, str, offset, or BaseIndexer subclass Interval of the moving window. If an integer, the delta between the start and end of each window. The number
(
self,
window: int | dt.timedelta | str | BaseOffset | BaseIndexer,
min_periods: int | None = None,
center: bool = False,
win_type: str | None = None,
on: str | None = None,
closed: IntervalClosedType | None = None,
step: int | None = None,
method: str = "single",
)
| 11919 | |
| 11920 | @final |
| 11921 | def rolling( |
| 11922 | self, |
| 11923 | window: int | dt.timedelta | str | BaseOffset | BaseIndexer, |
| 11924 | min_periods: int | None = None, |
| 11925 | center: bool = False, |
| 11926 | win_type: str | None = None, |
| 11927 | on: str | None = None, |
| 11928 | closed: IntervalClosedType | None = None, |
| 11929 | step: int | None = None, |
| 11930 | method: str = "single", |
| 11931 | ) -> Window | Rolling: |
| 11932 | """ |
| 11933 | Provide rolling window calculations. |
| 11934 | |
| 11935 | Parameters |
| 11936 | ---------- |
| 11937 | window : int, timedelta, str, offset, or BaseIndexer subclass |
| 11938 | Interval of the moving window. |
| 11939 | |
| 11940 | If an integer, the delta between the start and end of each window. |
| 11941 | The number of points in the window depends on the ``closed`` argument. |
| 11942 | |
| 11943 | If a timedelta, str, or offset, the time period of each window. Each |
| 11944 | window will be a variable sized based on the observations included in |
| 11945 | the time-period. This is only valid for datetimelike indexes. |
| 11946 | To learn more about the offsets & frequency strings, please see |
| 11947 | :ref:`this link<timeseries.offset_aliases>`. |
| 11948 | |
| 11949 | If a BaseIndexer subclass, the window boundaries |
| 11950 | based on the defined ``get_window_bounds`` method. Additional rolling |
| 11951 | keyword arguments, namely ``min_periods``, ``center``, ``closed`` and |
| 11952 | ``step`` will be passed to ``get_window_bounds``. |
| 11953 | |
| 11954 | min_periods : int, default None |
| 11955 | Minimum number of observations in window required to have a value; |
| 11956 | otherwise, result is ``np.nan``. |
| 11957 | |
| 11958 | For a window that is specified by an offset, ``min_periods`` will default |
| 11959 | to 1. |
| 11960 | |
| 11961 | For a window that is specified by an integer, ``min_periods`` will default |
| 11962 | to the size of the window. |
| 11963 | |
| 11964 | center : bool, default False |
| 11965 | If False, set the window labels as the right edge of the window index. |
| 11966 | |
| 11967 | If True, set the window labels as the center of the window index. |
| 11968 | |
| 11969 | win_type : str, default None |
| 11970 | If ``None``, all points are evenly weighted. |
| 11971 | |
| 11972 | If a string, it must be a valid `scipy.signal window function |
| 11973 | <https://docs.scipy.org/doc/scipy/reference/signal.windows.html#module-scipy.signal.windows>`__. |
| 11974 | |
| 11975 | Certain Scipy window types require additional parameters to be passed |
| 11976 | in the aggregation function. The additional parameters must match |
| 11977 | the keywords specified in the Scipy window type method signature. |
| 11978 |