Repository: sktime/sktime

Issue:
 The function 'plot_series' should accept series with different index types 
**Is your feature request related to a problem? Please describe.**
The plot_series function throws an error when multiple series with different index types are passed as parameters.

**Describe the solution you'd like**
The function should include implicit type casting of the series' indexes  

**Describe alternatives you've considered**
Manually converting the datatype of the series' indexes before passing them to the plot_series function using pandas 

**Additional context**
<img width="1009" alt="Screenshot 2021-05-20 at 4 48 00 PM" src="https://user-images.githubusercontent.com/56479884/118969810-25c21080-b98b-11eb-96b1-010d9a9d5a05.png">




Discussion:
```python
def _check_indices(x, y):
    # compare and check index x and y
```

Resolving patch:
diff --git a/sktime/utils/plotting.py b/sktime/utils/plotting.py
--- a/sktime/utils/plotting.py
+++ b/sktime/utils/plotting.py
@@ -21,12 +21,14 @@
 )
 """
 __all__ = ["plot_series", "plot_correlations"]
-__author__ = ["Markus Löning", "Ryan Kuhns"]
+__author__ = ["Markus Löning", "Ryan Kuhns", "Drishti Bhasin"]
 
 import numpy as np
 
 from sktime.utils.validation._dependencies import _check_soft_dependencies
 from sktime.utils.validation.forecasting import check_y
+from sktime.utils.validation.series import check_consistent_index_type
+
 from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
 
 
@@ -43,7 +45,7 @@ def plot_series(
         Names of series, will be displayed in figure legend
     markers: list, default = None
         Markers of data points, if None the marker "o" is used by default.
-        Lenght of list has to match with number of series
+        The length of the list has to match with the number of series.
 
     Returns
     -------
@@ -88,10 +90,8 @@ def plot_series(
     # create combined index
     index = series[0].index
     for y in series[1:]:
-        # check types, note that isinstance() does not work here because index
-        # types inherit from each other, hence we check for type equality
-        if not type(index) is type(y.index):  # noqa
-            raise TypeError("Found series with different index types.")
+        # check index types
+        check_consistent_index_type(index, y.index)
         index = index.union(y.index)
 
     # generate integer x-values
diff --git a/sktime/utils/seasonality.py b/sktime/utils/seasonality.py
--- a/sktime/utils/seasonality.py
+++ b/sktime/utils/seasonality.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3 -u
-# coding: utf-8
+# -*- coding: utf-8 -*-
 # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
 
 __author__ = ["Markus Löning"]
@@ -43,7 +43,8 @@ def autocorrelation_seasonality_test(y, sp):
     if n_timepoints < 3 * sp:
         warn(
             "Did not perform seasonality test, as `y`` is too short for the "
-            "given `sp`, returned: False")
+            "given `sp`, returned: False"
+        )
         return False
 
     else:
@@ -51,7 +52,10 @@ def autocorrelation_seasonality_test(y, sp):
         coef = coefs[sp]  # coefficient to check
 
         tcrit = 1.645  # 90% confidence level
-        limits = tcrit / np.sqrt(n_timepoints) * np.sqrt(
-            np.cumsum(np.append(1, 2 * coefs[1:] ** 2)))
+        limits = (
+            tcrit
+            / np.sqrt(n_timepoints)
+            * np.sqrt(np.cumsum(np.append(1, 2 * coefs[1:] ** 2)))
+        )
         limit = limits[sp - 1]  #  zero-based indexing
         return np.abs(coef) > limit
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
@@ -1,11 +1,17 @@
 #!/usr/bin/env python3 -u
 # -*- coding: utf-8 -*-
 
-__author__ = ["Markus Löning"]
-__all__ = ["check_series", "check_time_index", "check_equal_time_index"]
-
-import numpy as np
+"""Functions for checking input data."""
+
+__author__ = ["Markus Löning", "Drishti Bhasin"]
+__all__ = [
+    "check_series",
+    "check_time_index",
+    "check_equal_time_index",
+    "check_consistent_index_type",
+]
 import pandas as pd
+import numpy as np
 
 # We currently support the following types for input data and time index types.
 VALID_DATA_TYPES = (pd.DataFrame, pd.Series, np.ndarray)
@@ -13,7 +19,7 @@
 
 
 def _check_is_univariate(y):
-    """Check if series is univariate"""
+    """Check if series is univariate."""
     if isinstance(y, pd.DataFrame):
         raise ValueError("Data must be univariate, but found a pd.DataFrame")
     if isinstance(y, np.ndarray) and y.ndim > 1:
@@ -143,7 +149,6 @@ def check_equal_time_index(*ys):
     ValueError
         If (time) indices are not the same
     """
-
     # only validate indices if data is passed as pd.Series
     first_index = ys[0].index
     check_time_index(first_index)
@@ -153,3 +158,39 @@ def check_equal_time_index(*ys):
 
         if not first_index.equals(y.index):
             raise ValueError("Some (time) indices are not the same.")
+
+
+def _is_int_index(index):
+    """Check if index type is one of pd.RangeIndex or pd.Int64Index."""
+    return type(index) in (pd.Int64Index, pd.RangeIndex)
+
+
+def check_consistent_index_type(a, b):
+    """Check that two indices have consistent types.
+
+    Parameters
+    ----------
+    a : pd.Index
+        Index being checked for consistency
+    b : pd.Index
+        Index being checked for consistency
+
+    Raises
+    ------
+    TypeError
+        If index types are inconsistent
+    """
+    msg = (
+        "Found series with inconsistent index types, please make sure all "
+        "series have the same index type."
+    )
+
+    if _is_int_index(a):
+        if not _is_int_index(b):
+            raise TypeError(msg)
+
+    else:
+        # check types, note that isinstance() does not work here because index
+        # types inherit from each other, hence we check for type equality
+        if not type(a) is type(b):  # noqa
+            raise TypeError(msg)


Test patch:
diff --git a/sktime/utils/tests/test_plotting.py b/sktime/utils/tests/test_plotting.py
--- a/sktime/utils/tests/test_plotting.py
+++ b/sktime/utils/tests/test_plotting.py
@@ -1,4 +1,6 @@
+#!/usr/bin/env python3 -u
 # -*- coding: utf-8 -*-
+
 import numpy as np
 import pandas as pd
 import pytest
@@ -59,7 +61,7 @@ def test_plot_series_invalid_input_type_raises_error(series_to_plot, valid_data_
 def test_plot_series_with_unequal_index_type_raises_error(
     series_to_plot, valid_data_types
 ):
-    match = "Found series with different index types."
+    match = "Found series with inconsistent index types"
     with pytest.raises(TypeError, match=match):
         _plot_series(series_to_plot)
 
@@ -165,3 +167,17 @@ def test_plot_correlations_output_type(series_to_plot):
             f"but returned: {type(fig)} and {type(ax)}",
         ]
     )
+
+
+def test_plot_series_uniform_treatment_of_int64_range_index_types():
+    # We test that int64 and range indices are treated uniformly and do not raise an
+    # error of inconsistent index types
+    _check_soft_dependencies("matplotlib")
+    import matplotlib.pyplot as plt
+
+    y1 = pd.Series(np.arange(10))
+    y2 = pd.Series(np.random.normal(size=10))
+    y1.index = pd.Int64Index(y1.index)
+    y2.index = pd.RangeIndex(y2.index)
+    plot_series(y1, y2)
+    plt.gcf().canvas.draw_idle()