title: Python Time Series ARIMA Forecast
body: <p>I am trying to implement a time series forecast and followed the helpful tutorial as found here : <a href="https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/" rel="nofollow noreferrer">https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/</a></p>
  
  <p>A sample of my time series object, after log transformations and so on can be found below:</p>
  
  <pre><code>ts = 
  
  2015-02-01  4.532599
  2015-03-01  7.635787
  2015-04-01  7.698029
  2015-05-01  4.564348
  2015-06-01  4.744932
  2015-09-01  5.365976
  2015-10-01  7.657283
  2016-02-01  7.059618
  2016-03-01  5.433722
  2016-04-01  7.600902
  </code></pre>
  
  <p>When I get at the point to try and fir the AR model, i.e.</p>
  
  <pre><code>model = ARIMA(ts_log, order=(1, 1, 0))
  results_AR = model.fit(disp=-1)
  plt.plot(ts_log)
  plt.plot(results_AR.fittedvalues, color='red')
  plt.title('RSS: %.4f'% sum((results_AR.fittedvalues-ts_log_diff)**2))
  plt.show()
  </code></pre>
  
  <p>My issue is when I try to do so I get:</p>
  
  <pre><code>TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('&lt;U21') dtype('&lt;U21') dtype('&lt;U21')
  </code></pre>
  
  <p>When I print out the type of data in my time series index I get:</p>
  
  <pre><code>DatetimeIndex(['2015-05-01'], dtype='datetime64[ns]', freq=None)
  </code></pre>
  
  <p>Then I tried adding the date parameter in ARIMA() like this:</p>
  
  <pre><code>model = ARIMA(dt_ts, order=(1, 1, 0), dates=dt_ts.index.values)
  </code></pre>
  
  <p>or by adding a separate array that has all my dates called formatted:</p>
  
  <pre><code>model = ARIMA(dt_ts, order=(1, 1, 0), dates=formatted)
  </code></pre>
  
  <p>And in both cases I got this:</p>
  
  <pre><code>ValueError: Given a pandas object and the index does not contain dates
  </code></pre>
  
  <p>Anyone has an idea why this happens and how I can fix it?</p>
  
  <p>Thanks in advance.</p>