Python сезонная_декомпозиционная функция из библиотеки Statsmodels, предоставляющая ValueError - PullRequest
0 голосов
/ 30 апреля 2018

Я пытаюсь разложить сезонность и динамику данных моего временного ряда, используя функцию season_decompose из библиотеки Statsmodels, но получаю ValueError

Данные:

                    A (Current average)
     TS 
2017-12-01 00:01:00 3.274965
2017-12-01 00:02:00 3.274083
2017-12-01 00:03:00 3.262563
2017-12-01 00:04:00 3.278352
2017-12-01 00:05:00 3.251769

Индекс данных:

ts_log.index

вывод:

DatetimeIndex(['2017-12-01 00:01:00', '2017-12-01 00:02:00',
               '2017-12-01 00:03:00', '2017-12-01 00:04:00',
               '2017-12-01 00:05:00', '2017-12-01 00:06:00',
               '2017-12-01 00:07:00', '2017-12-01 00:08:00',
               '2017-12-01 00:09:00', '2017-12-01 00:10:00',
               ...
               '2018-01-04 23:26:00', '2018-01-04 23:27:00',
               '2018-01-04 23:28:00', '2018-01-04 23:29:00',
               '2018-01-04 23:30:00', '2018-01-04 23:31:00',
               '2018-01-04 23:32:00', '2018-01-04 23:33:00',
               '2018-01-04 23:34:00', '2018-01-04 23:35:00'],
              dtype='datetime64[ns]', name='TS', length=50000, freq=None)

Разлагающая сезонность

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

Ошибка:

ValueError                                Traceback (most recent call last)
<ipython-input-79-7ca5a90bdbf8> in <module>()
      1 from statsmodels.tsa.seasonal import seasonal_decompose
----> 2 decomposition = seasonal_decompose(ts_log)
      3 
      4 trend = decomposition.trend
      5 seasonal = decomposition.seasonal

C:\Users\Paras Mani\Anaconda2\envs\py3\lib\site-packages\statsmodels\tsa\seasonal.py in seasonal_decompose(x, model, filt, freq, two_sided)
     82             freq = pfreq
     83         else:
---> 84             raise ValueError("You must specify a freq or x must be a "
     85                              "pandas object with a timeseries index with"
     86                              "a freq not set to None")

ValueError: You must specify a freq or x must be a pandas object with a timeseries index witha freq not set to None

Здесь я использую индекс временных рядов, но частота не установлена. Как я могу изменить частоту.

...