I need to get the same result of the following code:
from statsmodels.tsa.seasonal import seasonal_decompose
# the values are just a list of numbers ([589, 561, 640, 656, ...])
values = list(df['Monthly milk production'].as_matrix().transpose())
trend = seasonal_decompose(values, freq = 12).trend
but without using the statsmodels module
I wonder if there is just a formula that computes the trend values so I can replace that formula with native python.
You can check the actual code of statsmodels.tsa.seasonal.
It is online at https://github.com/statsmodels/statsmodels/blob/master/statsmodels/tsa/seasonal.py
All in Python