Временные ряды с использованием Python года 0 вне диапазона - PullRequest
0 голосов
/ 11 марта 2019

Я делал анализ временных рядов с использованием Python. Я прочитал CSV-файл, скачанный с Yahoo Finance, Yahoo Apple, исторические данные

    aapl_df = pd.read_csv('AAPL.csv',
                     parse_dates=['Date'], 
                     index_col='Date'
                     )
    aapl_df.head()
        # Simple Exponential Smoothing
    adj_price = pd.Series(aapl_df['Adj Close'])
    fit1 = SimpleExpSmoothing(adj_price).fit(smoothing_level=0.2,optimized=False)
    fcast1 = fit1.forecast(12).rename(r'$\alpha=0.2$')
    # plot
    fcast1.plot(marker='o', color='blue', legend=True)
    fit1.fittedvalues.plot(marker='o',  color='blue')

Когда я использовал библиотеку SimpleExpSmoothing и Holt,

произошла ошибка

/home/jupyterlab/conda/lib/python3.6/site-packages/statsmodels/tsa/base/tsa_model.py:225: ValueWarning: A date index has been provided, but it has no associated frequency information and so will be ignored when e.g. forecasting.
  ' ignored when e.g. forecasting.', ValueWarning)
/home/jupyterlab/conda/lib/python3.6/site-packages/statsmodels/tsa/base/tsa_model.py:531: ValueWarning: No supported index is available. Prediction results will be given with an integer index beginning at `start`.
  ValueWarning)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-740724523405> in <module>
      4 # plot
      5 fcast1.plot(marker='o', color='blue', legend=True)
----> 6 fit1.fittedvalues.plot(marker='o',  color='blue')
      7 
      8 

~/conda/lib/python3.6/site-packages/matplotlib/dates.py in tick_values(self, vmin, vmax)
   1408         ymax = self.base.ge(vmax.year) * self.base.step
   1409 
-> 1410         ticks = [vmin.replace(year=ymin, **self.replaced)]
   1411         while True:
   1412             dt = ticks[-1]

ValueError: year 0 is out of range

Может ли кто-нибудь помочь мне с этим, пожалуйста?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...