Pandas provides a number of functions to compute moving (also known as rolling) statistics. A rolling window computes the specified statistic on a specified interval of data. The window is then moved along the data by a specific interval and recalculated. The process continues until the window has been rolled across the entire dataset.
To demonstrate this, we will start with a series of 1000 random numbers that are cumulatively summed to form a random walk:
Zooming in on the first 100 values, we can see the movement of the data with the following plot:
To start creating a rolling window, we create a Rolling ...