Filtering the time series data

Removing the noise via smoothing is only one of the techniques. In this recipe, we will see how to use convolution and other filters to extract only certain frequencies from our data.

Getting ready

To execute this recipe, you will need pandas, Statsmodels, NumPy, Scipy, and Matplotlib. No other prerequisites are required.

How to do it…

Convolution, in layman terms, can be understood as an overlap between a function f (our time series) and some function g (our filter). Convolution blurs the time series (and in this sense can be understood as a smoothing technique).

Note

A good introduction to convolution can be found at http://www.songho.ca/dsp/convolution/convolution.html.

The following script can be found in td_filtering.py ...

Get Practical Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.