Lag plots are most commonly used to look for patterns in time series data.
So this recipe is a short example on How to create a lag plot for timeseries data. Let's get started.
import pandas as pd
Let's pause and look at these imports. Pandas is generally used for performing mathematical operation and preferably over arrays.
df = pd.read_csv('https://raw.githubusercontent.com/selva86/datasets/master/a10.csv', parse_dates=['date']).set_index('date')
Here we have imported random time series dataset from github.
Now our dataset is ready.
Using lag_plot, we are plotting our dataset. Lag here is set to be 1.
Once we run the above code snippet, we will see:
Scroll down to the ipython file to look at the results.
This dataset has almost all the featurers of time variation. Lag clearly helps in understanding how these features are set in.