2
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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

The function is called pmdarima.arima.ndiffs

$\endgroup$
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.