Detection of stationarity

There are multiple methods that can help us in figuring out whether the data is stationary, listed as follows:

  • Plotting the data: Having a plot of the data with respect to the time variable can help us to see whether it has got a trend. We know from the definition of stationarity that a trend in the data means that there is no constant mean and variance. Let's do this in Python. For this example, we are using international airline passenger data.

First, let's load all the required libraries, as follows:

 from pandas import Seriesfrom matplotlib import pyplot%matplotlib inlinedata = Series.from_csv('AirPassengers.csv', header=0)  series.plot()  pyplot.show()

We will get the following output:

It is quite clear from ...

Get Machine Learning Quick Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.