Although the question seems to have been tackled a lot, I cannot figure out why seasonal decompose doesn't work in my case although I am giving as input a dataframe with a Datetime Index. Here is an example of my dataset:
Customer order actual date Sales Volumes
0 01/01/1900 300
1 10/03/2008 3000
2 15/11/2013 10
3 23/12/2013 200
4 04/03/2014 5
5 17/03/2014 30
6 22/04/2014 1
7 26/06/2014 290
8 30/06/2014 40
the code snippet is shown below:
from statsmodels.tsa.seasonal import seasonal_decompose
df_agg['Customer order actual date'] = pd.to_datetime(df_agg['Customer order actual date'])
df_agg = df_agg.set_index('Customer order actual date')
df_agg.reset_index().sort_values('Customer order actual date', ascending=True)
decomposition = seasonal_decompose(np.asarray(df_agg['Sales Volumes'] ), model = 'multiplicative')
But I get systematically the following error:
: You must specify a freq or x must be a pandas object with a timeseries index witha freq not set to None
Could you please explain why I should give a freq input although I am using a dataframe with Datetime Index? Does it make sense to give a frequency as an input paramater whereas I am looking for the seasonality as an output of seasonal_decompose?