Repository: modin-project/modin

Issue:
Printing empty modin.Series leads to raising exception
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Windows 10 1809
- **Modin version** (`modin.__version__`): 0.7.3+148.ga2d7189
- **Python version**: 3.7.5
- **Code we can use to reproduce**:
```python
if __name__ == "__main__":
    import modin.pandas as pd
    
    s = pd.Series()
    print(s)

```
<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->
Related code will raise an exception with that traceback:
```
Traceback (most recent call last):
  File "t2.py", line 5, in <module>
    print(s)
  File "C:\Users\dchigare\Desktop\REPOS\modin\modin\pandas\base.py", line 3471, in __str__
    return repr(self)
  File "C:\Users\dchigare\Desktop\REPOS\modin\modin\pandas\series.py", line 298, in __repr__
    temp_df = temp_df.iloc[:, 0]
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas\core\indexing.py", line 1762, in __getitem__
    return self._getitem_tuple(key)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas\core\indexing.py", line 2067, in _getitem_tuple
    self._has_valid_tuple(tup)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas\core\indexing.py", line 703, in _has_valid_tuple
    self._validate_key(k, i)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas\core\indexing.py", line 1994, in _validate_key
    self._validate_integer(key, axis)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pandas\core\indexing.py", line 2063, in _validate_integer
    raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
```



Discussion:
Will try to fix this.
This was not caught because the `test_data` data for parameterized tests doesn't include an empty value.

Resolving patch:
diff --git a/modin/pandas/series.py b/modin/pandas/series.py
--- a/modin/pandas/series.py
+++ b/modin/pandas/series.py
@@ -310,7 +310,7 @@ def __repr__(self):
         num_rows = pandas.get_option("max_rows") or 60
         num_cols = pandas.get_option("max_columns") or 20
         temp_df = self._build_repr_df(num_rows, num_cols)
-        if isinstance(temp_df, pandas.DataFrame):
+        if isinstance(temp_df, pandas.DataFrame) and not temp_df.empty:
             temp_df = temp_df.iloc[:, 0]
         temp_str = repr(temp_df)
         if self.name is not None:
@@ -321,7 +321,11 @@ def __repr__(self):
             len_str = "Length: {}, ".format(len(self.index))
         else:
             len_str = ""
-        dtype_str = "dtype: {}".format(temp_str.rsplit("dtype: ", 1)[-1])
+        dtype_str = "dtype: {}".format(
+            str(self.dtype) + ")"
+            if temp_df.empty
+            else temp_str.rsplit("dtype: ", 1)[-1]
+        )
         if len(self) == 0:
             return "Series([], {}{}".format(name_str, dtype_str)
         return temp_str.rsplit("\nName:", 1)[0] + "\n{}{}{}".format(


Test patch:
diff --git a/modin/pandas/test/test_series.py b/modin/pandas/test/test_series.py
--- a/modin/pandas/test/test_series.py
+++ b/modin/pandas/test/test_series.py
@@ -470,6 +470,11 @@ def test___pow__(data):
     inter_df_math_helper(modin_series, pandas_series, "__pow__")
 
 
+def test___repr___empty():
+    modin_series, pandas_series = pd.Series(), pandas.Series()
+    assert repr(modin_series) == repr(pandas_series)
+
+
 @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)
 def test___repr__(data):
     modin_series, pandas_series = create_test_series(data)
@@ -1355,6 +1360,11 @@ def test_dropna_inplace(data):
     df_equals(modin_series, pandas_series)
 
 
+def test_dtype_empty():
+    modin_series, pandas_series = pd.Series(), pandas.Series()
+    assert modin_series.dtype == pandas_series.dtype
+
+
 @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)
 def test_dtype(data):
     modin_series, pandas_series = create_test_series(data)