'Trend and Seasonality from time series

how can we extract trend, seasonality from a time series in a way SARIMAX does internally.

I need to use the same to understand how much importance (feature importance) trend, seasonality, AR component, MA component and exogenous variables are to the forecast.



Solution 1:[1]

You can do this way -

from statsmodels.tsa.seasonal import seasonal_decompose

#decomposition
decomposition = seasonal_decompose(x = df.y, model = 'multiplicative') 
decomposition.plot()

# df is the dataframe of y is the name of column having values of which you want 
to see trends and seasonality.
# model value can be additive or multiplicative. 

              

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JATIN