Categories
decomposition pandas python statistics time-series

value error in python statsmodels.tsa.seasonal

I have this dataframe with date time indices:

ts_log:

date    price_per_unit
2013-04-04 12.762369
2013-04-05 12.777120
2013-04-06 12.773146
2013-04-07 12.780774
2013-04-08 12.786835

I have this piece of code for decomposition

from statsmodels.tsa.seasonal import seasonal_decompose
decomposition = seasonal_decompose(ts_log)
trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.resid

but in the line decomposition = seasonal_decompose(ts_log)
i got this error :

ValueError: You must specify a freq or x must be a pandas object with a timeseries index

Where is the problem?