1import numpy as np
2import pandas as pd
3from statsmodels.tsa.seasonal import seasonal_decompose
4
5# Generate some data
6np.random.seed(0)
7n = 1500
8dates = np.array('2005-01-01', dtype=np.datetime64) + np.arange(n)
9data = 12*np.sin(2*np.pi*np.arange(n)/365) + np.random.normal(12, 2, 1500)
10df = pd.DataFrame({'data': data}, index=dates)
11
12# Reproduce the example in OP
13seasonal_decompose(df, model='additive', freq=1).plot()
14