Repository: sktime/sktime

Issue:
[BUG] ARIMA.fit with numpy arrays not working correctly
**Describe the bug**
If I execute ARIMA().fit with numpy arrays, it will fails with a strange error message. It says that the indexes of the input Time Series does not fit to the exogenous variables Time Series. And prints the input time series values as missing index values for the exogenous variables time series.

**To Reproduce**
<!--
Add a Minimal, Complete, and Verifiable example (for more details, see e.g. https://stackoverflow.com/help/mcve

If the code is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com
-->

```python
rand = np.random.random(1000)
rand_x = np.random.random(1000)
ar = ARIMA()
assert rand.shape == rand_x.shape
ar.fit(rand, X=rand_x)
```

**Expected behavior**
ARIMA should be fitted without an error.

**Additional context**
I suppose the problem is line 269ff in series.py. The supposed index are the values of y. I would expect that the index is something like `np.arange(0, len(y)`. I can implement this fix, but I assume that this would have effects on lots of other transformers too.

```python
        if isinstance(y, np.ndarray):
            y_index = pd.Index(y)
        else:
            y_index = y.index
```

<!--
Add any other context about the problem here.
-->

**Versions**
<details>

   machine: Windows-10-10.0.18362-SP0
Python dependencies:
          pip: 22.0.3
   setuptools: 60.8.2
      sklearn: 1.0.2
       sktime: 0.13.0
  statsmodels: 0.13.2
        numpy: 1.21.6
        scipy: 1.7.3
       pandas: 1.4.1
   matplotlib: 3.5.1
       joblib: 1.1.0
        numba: 0.55.1
     pmdarima: 1.8.5
      tsfresh: None
<!--
Please run the following code snippet and paste the output here:
 
from sktime import show_versions; show_versions()
-->

</details>

<!-- Thanks for contributing! -->



Discussion:
Yes, you are right! Line 270 should be `y_index = pd.Index(range(len(y)))`.
Strange that this went undetected for so long - we don't have numpy scenarios.

Would appreciate a PR, I'm also investigating further, there seem to be more problems with that function

Resolving patch:
diff --git a/sktime/utils/validation/series.py b/sktime/utils/validation/series.py
--- a/sktime/utils/validation/series.py
+++ b/sktime/utils/validation/series.py
@@ -267,7 +267,7 @@ def check_equal_time_index(*ys, mode="equal"):
 
     for i, y in enumerate(y_not_None[1:]):
         if isinstance(y, np.ndarray):
-            y_index = pd.Index(y)
+            y_index = pd.Index(range(len(y)))
         else:
             y_index = y.index
 


Test patch:
diff --git a/sktime/utils/validation/tests/test_series.py b/sktime/utils/validation/tests/test_series.py
new file mode 100644
--- /dev/null
+++ b/sktime/utils/validation/tests/test_series.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3 -u
+# -*- coding: utf-8 -*-
+# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
+"""Test series module."""
+
+__author__ = ["benheid"]
+
+import numpy as np
+import pytest
+
+from sktime.utils.validation.series import check_equal_time_index
+
+first_arrays = (np.random.random(1000),)
+second_arrays = (np.random.random(1000),)
+
+
+@pytest.mark.parametrize("first_array", first_arrays)
+@pytest.mark.parametrize("second_array", second_arrays)
+def test_check_equal_time_index(first_array, second_array):
+    """Test that fh validation throws an error with empty container."""
+    check_equal_time_index(first_array, second_array)