Book Image

Python Data Analysis

By : Ivan Idris
Book Image

Python Data Analysis

By: Ivan Idris

Overview of this book

Table of Contents (22 chapters)
Python Data Analysis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Key Concepts
Online Resources
Index

Window functions


NumPy has a number of window routines that can compute weights in a rolling window as we did in the previous section.

A window function is a function that is defined within an interval (the window) or is otherwise zero valued. We can use window functions 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:

In the preceding formula, L can be equal to N, N+1, or N-1. In the last case, the window function is called the Bartlett window. The Blackman window is bell shaped and defined as follows:

The Hanning window is also bell shaped and defined as follows:

In the pandas API, the rolling_window() function provides the same functionality with different values of the win_type string parameter corresponding to different window functions. The other parameter...