Applications of Rolling Windows for Time Series, with Python
Last night I was doing laundry with my wife. We have this non-verbal agreement (it becomes pretty verbal when I break it though) about laundry: she is the one who puts the laundry in the washer and drier and I am the one who folds it.
The way we do this is usually like this:

Now, I don't really fold all the clothes and put them away. Otherwise, I would be swimming in clothes. What I do is an approach that reminds me of the rolling window method:

Why do I say that it reminds me of a rolling window? Let's see the analogy.

The idea of rolling windows is exactly the one that I apply when folding laundry. I have a task to do but you don't do it all at once, because it would be nonpractical and not useful. Instead, I do it on a small portion of "data", then store the "result", and then move to the next section of "data".
This idea looks very simple, but there are SO MANY things you can do with Rolling Windows, as this very simple approach is also incredibly powerful.
In this blog post, I want to describe very briefly what rolling windows are on a technical level, then show a few powerful applications of rolling windows on some specific tasks that are often required when dealing with a signal.
We will do this in the following order:
- A technical introduction about the rolling windows idea
- We'll use rolling windows as feature extractors (first use case)
- We'll use rolling windows as a smoother/noise reducer (second use case)
- We'll use rolling windows to extract peaks and valleys of a signal (third use case)
- We'll use rolling windows to perform a Fourier Transform (fourth use case)
A lot to cover, better get started!