May 2019
Intermediate to advanced
456 pages
11h 38m
English
Autocorrelation is the correlation between two elements of a series separated by a given interval. Intuitively, we would, for example, assume that knowledge about the last time step helps us in forecasting the next step. But how about knowledge from 2 time steps ago or from 100 time steps ago?
Running autocorrelation_plot will plot the correlation between elements with different lag times and can help us answer these questions. As a matter of fact, pandas comes with a handy autocorrelation plotting tool. To use it, we have to pass a series of data. In our case, we pass the page views of a page, selected at random.
We can do this by running the following code:
from pandas.plotting import autocorrelation_plot autocorrelation_plot(data.iloc[110]) ...