xxxxxxxxxx
# Time series decomposition
import statsmodels.api as sm
import matplotlib.pyplot as plt
from pylab import rcParams
rcParams['figure.figsize'] = 11, 9
decomposition = sm.tsa.seasonal_decompose(df['col'])
fig = decomposition.plot()
plt.show()
print(dir(decomposition)) # See what can be used
decomp_seasonal = decomposition.seasonal # Seasonal component
decomp_trend = decomposition.trend # Trend component
decomp_resid = decomp.resid # Residual component