NumPy offers several window options that can compute weights in a rolling window as we did in the previous section.
The window function uses an interval for spectral analysis and filter design (for more background information, refer to http://en.wikipedia.org/wiki/Window_function). The boxcar window is a rectangular window with the following formula:
w(n) = 1
The triangular window is shaped like a triangle and has the following formula:
Here, L can be equal to N, N+1, or N–1.
If the value of L is N–1, it is known as the Bartlett window and has the following formula:
In the pandas module, the DataFrame.rolling() function provides the same functionality using the win_type parameter for different window functions. Another parameter is the window for defining the size of the window, which is easy to set as shown in the previous...