# ndiffs for Python

Is there a function equivalent of R's ndiffs function in Python? It is used to estimate a number of diffs for creating stationary time-series.

R Documentation

There is a function implemented in pmdarima that can help you finding the number of diffs.

The function is called pmdarima.arima.ndiffs

I am not sure if there any is any library that can directly make your data stationary in python. However, you can plot your time series, which will visually tell you the components such as trend and seasonality of your data.

using statsmodel you can take each a look at each component of a time-series like this,

trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.residual


After this you can use shift function to make your time-series stationary by taking off trend and seasonality.

Refer to this tutorial, which has in detail to make your time-series stationary based on your data. Hope this helps.