MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to determine if a time series is stationery?

# How to determine if a time series is stationery?

This recipe helps you determine if a time series is stationery

Time series are stationary if they do not have trend or seasonal effects. Summary statistics calculated on the time series are consistent over time, like the mean or the variance of the observations. It can be observed easily through plots or summary statistics.

So this recipe is a short example on how to determine if a time series is stationary. Let's get started.

```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```

Let's pause and look at these imports. Numpy and pandas are general ones. Here matplotlib.pyplot will help us in plotting

```
df = pd.read_csv('https://raw.githubusercontent.com/selva86/datasets/master/a10.csv', parse_dates=['date']).set_index('date')
```

Here, we have used one time series data from github. Also, we have set our index to date.

Now our dataset is ready.

```
df.plot()
plt.show()
```

We have simply plotted dataset, taking time on x axis and values on y axis.

```
X = df.value
split = round(len(X) / 2)
X1, X2 = X[0:split], X[split:]
mean1, mean2 = X1.mean(), X2.mean()
var1, var2 = X1.var(), X2.var()
```

We have split our dataset in two set. Next, we are trying to caluclate mean and variance of both split dataset.

```
print('mean1=%f, mean2=%f' % (mean1, mean2))
print('variance1=%f, variance2=%f' % (var1, var2))
```

Simply print the mean and variance.

Once we run the above code snippet, we will see:

Scroll down the ipython file to visualize the output.

A disparity in values can be seen indicating presence of non-stationary points.

In this deep learning project, you will build your own face recognition system in Python using OpenCV and FaceNet by extracting features from an image of a person's face.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

In this deep learning project, you will learn how to build your custom OCR (optical character recognition) from scratch by using Google Tesseract and YOLO to read the text from any images.

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.