Autocorrelation plots

Autocorrelation plots graph autocorrelations of time series data for different lags. Autocorrelation is the correlation of a time series with the same time series lagged. The autocorrelation_plot() pandas function in pandas.tools.plotting can draw an autocorrelation plot.

The following is the code from the autocorr_plot.py file in this book's code bundle:

import matplotlib.pyplot as plt import numpy as np import pandas as pd from pandas.tools.plotting import autocorrelation_plot df = pd.read_csv('transcount.csv') df = df.groupby('year').aggregate(np.mean) gpu = pd.read_csv('gpu_transcount.csv') gpu = gpu.groupby('year').aggregate(np.mean) df = pd.merge(df, gpu, how='outer', left_index=True, right_index=True) df = df.replace(np.nan, ...

Get Python Data Analysis 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.