You must specify a period

Viewed 55

I have created the following time series:

year_2007_gap_ts = pd.date_range('2007-01-01', periods=365, freq='D')

which produces the following dtype:

dtype='datetime64[ns]', length=365, freq='D'

When I try to decompose with the following:

result = seasonal_decompose(year_2007_gap_ts, model='additive')
print(result.trend)
print(result.seasonal)
print(result.resid)
print(result.observed)

I get a ValueError: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None

Any idea as to what is causing this error and how to fix it?

0 Answers
Related