Index(...) must be called with a collection of some kind, 'seasonal' was passed Error while trying decomposition in time series

Viewed 124

I have a time series dataset with weather data.

I set as index the date column with the following code

data = data.set_index("date")
data

and it runs without any errors

Now I am trying decomposition with the following code

import statsmodels.api as sm
decomposition = sm.tsa.seasonal_decompose(data, model = 'additive', period = 2)
fig = decomposition.plot()
matplotlib.rcParams['figure.figsize'] = [9.0, 5.0]

And I am getting this error:

TypeError: Index(...) must be called with a collection of some kind, 'seasonal' was passed 

What can I do?

0 Answers
Related