0

I have a dataframe like the following

df:
                         M3.1.3
ts_dt   
2019-11-07 09:38:28.850 0.00441
2019-11-07 09:38:31.513 0.00440
2019-11-07 09:38:34.167 0.00434
2019-11-07 09:38:36.821 0.00439
2019-11-07 09:38:40.387 0.00442

where the index is a datatime. I would like to do some time series analysis like here.

This is what I am doing

from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(df, model='additive')

and I got this error

ValueError: You must specify a freq or x must be a pandas object with a timeseries index with a freq not set to None
emax
  • 6,965
  • 19
  • 74
  • 141
  • I think you can check [this](https://stackoverflow.com/questions/34494780/time-series-analysis-unevenly-spaced-measures-pandas-statsmodels) – jezrael Dec 08 '19 at 16:31
  • It looks like you need to specify which column in your df contains the data, and what the frequency is. Try seasonal_decompose(df.yourcolumn, freq=1, model='additive') – RandomForestRanger Mar 18 '20 at 13:14
  • it should work for seasonal_decompose(df.yourcolumn, period=1, model='additive') – Zed Fang Aug 04 '23 at 01:33

0 Answers0