Repository: statsmodels/statsmodels

Issue:
Master failing on Python 3.6 with NumPy 1.12
Appears to be a bug in date handling

```

======================================================================
ERROR: statsmodels.tsa.tests.test_arima.test_arima_predict_pandas_nofreq
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 391, in _get_index_label_loc
    index = self.data.row_labels[:loc + 1]
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python3.6/site-packages/pandas/tseries/base.py", line 276, in __getitem__
    result = getitem(key)
TypeError: only integer scalar arrays can be converted to a scalar index

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 448, in _get_prediction_index
    start, start_index, start_oos = self._get_index_label_loc(start)
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 394, in _get_index_label_loc
    raise e
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 384, in _get_index_label_loc
    self._get_index_loc(key, base_index))
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 335, in _get_index_loc
    loc = index.get_loc(key)
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python3.6/site-packages/pandas/indexes/base.py", line 2136, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/index.pyx", line 132, in pandas.index.IndexEngine.get_loc (pandas/index.c:4433)
  File "pandas/index.pyx", line 156, in pandas.index.IndexEngine.get_loc (pandas/index.c:4363)
KeyError: '2010-1-7'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/tests/test_arima.py", line 1644, in test_arima_predict_pandas_nofreq
    predict = arma.predict(start="2010-1-7", end=10) # should be of length 10
  File "/home/travis/build/bashtage/statsmodels/statsmodels/base/wrapper.py", line 95, in wrapper
    obj = data.wrap_output(func(results, *args, **kwargs), how)
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/arima_model.py", line 1494, in predict
    return self.model.predict(self.params, start, end, exog, dynamic)
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/arima_model.py", line 721, in predict
    self._get_prediction_index(start, end, dynamic))
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/arima_model.py", line 653, in _get_prediction_index
    super(ARMA, self)._get_prediction_index(start, end, index))
  File "/home/travis/build/bashtage/statsmodels/statsmodels/tsa/base/tsa_model.py", line 450, in _get_prediction_index
    raise KeyError('The `start` argument could not be matched to a'
KeyError: 'The `start` argument could not be matched to a location related to the index of the data.'

----------------------------------------------------------------------
```

from https://travis-ci.org/bashtage/statsmodels/jobs/200636162


ping @ChadFulton 


Discussion:
Problem seems to be that the index, which is DatetimeIndex, is being replaced with an Int64Index, and then it isn't possible to lookup dates.

Resolving patch:
diff --git a/statsmodels/tsa/base/tsa_model.py b/statsmodels/tsa/base/tsa_model.py
--- a/statsmodels/tsa/base/tsa_model.py
+++ b/statsmodels/tsa/base/tsa_model.py
@@ -388,6 +388,7 @@ def _get_index_label_loc(self, key, base_index=None):
                     loc = self.data.row_labels.get_loc(key)
                 else:
                     raise
+                loc = loc[0]  # Require scalar
                 index = self.data.row_labels[:loc + 1]
                 index_was_expanded = False
             except:


Test patch: