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 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.