Book Image

Mastering Pandas for Finance

By : Michael Heydt
Book Image

Mastering Pandas for Finance

By: Michael Heydt

Overview of this book

Table of Contents (16 chapters)
Mastering pandas for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Moving windows


A number of functions are provided to compute moving (also known as rolling) statistics, where the function computes the statistic on a window of data represented by a particular period of time and then slides the window across the data by a specified interval, continually calculating the statistic as long as the window falls first within the dates of the time-series.

With the following functions, pandas provides direct support for rolling windows:

Function

Description

rolling_mean

This is the mean of the values in the window

rolling_std

This is the standard deviation of the values in the window

rolling_var

This is the variance of values

rolling_min

This is the minimum of the values in the window

rolling_max

This is maximum of the values in the window

rolling_cov

This is the covariance of values

rolling_quantile

This is the moving window score at the percentile/sample quantile

rolling_corr

This is the correlation of the values in the window

...