Repository: modin-project/modin

Issue:
New API: `tz_convert` for Series and DataFrame

### Describe the problem
<!-- Describe the problem clearly here. -->
`tz_convert` involves only changing the Index/Columns values.



Discussion:

Resolving patch:
diff --git a/modin/pandas/base.py b/modin/pandas/base.py
--- a/modin/pandas/base.py
+++ b/modin/pandas/base.py
@@ -3154,9 +3154,15 @@ def transform(self, func, axis=0, *args, **kwargs):
         return result
 
     def tz_convert(self, tz, axis=0, level=None, copy=True):
-        return self._default_to_pandas(
-            "tz_convert", tz, axis=axis, level=level, copy=copy
-        )
+        axis = self._get_axis_number(axis)
+        if level is not None:
+            new_labels = (
+                pandas.Series(index=self.axes[axis]).tz_convert(tz, level=level).index
+            )
+        else:
+            new_labels = self.axes[axis].tz_convert(tz)
+        obj = self.copy() if copy else self
+        return obj.set_axis(new_labels, axis, inplace=not copy)
 
     def tz_localize(
         self, tz, axis=0, level=None, copy=True, ambiguous="raise", nonexistent="raise"


Test patch:
diff --git a/modin/pandas/test/test_dataframe.py b/modin/pandas/test/test_dataframe.py
--- a/modin/pandas/test/test_dataframe.py
+++ b/modin/pandas/test/test_dataframe.py
@@ -2615,11 +2615,29 @@ def test_tshift(self):
             df.to_period().tshift()
 
     def test_tz_convert(self):
-        idx = pd.date_range("1/1/2012", periods=5, freq="M")
-        df = pd.DataFrame(np.random.randint(0, 100, size=(len(idx), 4)), index=idx)
+        modin_idx = pd.date_range(
+            "1/1/2012", periods=500, freq="2D", tz="America/Los_Angeles"
+        )
+        pandas_idx = pandas.date_range(
+            "1/1/2012", periods=500, freq="2D", tz="America/Los_Angeles"
+        )
+        data = np.random.randint(0, 100, size=(len(modin_idx), 4))
+        modin_df = pd.DataFrame(data, index=modin_idx)
+        pandas_df = pandas.DataFrame(data, index=pandas_idx)
+        modin_result = modin_df.tz_convert("UTC", axis=0)
+        pandas_result = pandas_df.tz_convert("UTC", axis=0)
+        df_equals(modin_result, pandas_result)
 
-        with pytest.warns(UserWarning):
-            df.tz_localize("America/Los_Angeles").tz_convert("America/Los_Angeles")
+        modin_multi = pd.MultiIndex.from_arrays([modin_idx, range(len(modin_idx))])
+        pandas_multi = pandas.MultiIndex.from_arrays(
+            [pandas_idx, range(len(modin_idx))]
+        )
+        modin_series = pd.DataFrame(data, index=modin_multi)
+        pandas_series = pandas.DataFrame(data, index=pandas_multi)
+        df_equals(
+            modin_series.tz_convert("UTC", axis=0, level=0),
+            pandas_series.tz_convert("UTC", axis=0, level=0),
+        )
 
     def test_tz_localize(self):
         idx = pd.date_range("1/1/2012", periods=5, freq="M")
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
@@ -2598,12 +2598,27 @@ def test_tshift():
 
 
 def test_tz_convert():
-    idx = pd.date_range("1/1/2012", periods=5, freq="M")
-    modin_series = pd.Series(np.random.randint(0, 100, size=len(idx)), index=idx)
-    with pytest.warns(UserWarning):
-        modin_series.tz_localize("America/Los_Angeles").tz_convert(
-            "America/Los_Angeles"
-        )
+    modin_idx = pd.date_range(
+        "1/1/2012", periods=400, freq="2D", tz="America/Los_Angeles"
+    )
+    pandas_idx = pandas.date_range(
+        "1/1/2012", periods=400, freq="2D", tz="America/Los_Angeles"
+    )
+    data = np.random.randint(0, 100, size=len(modin_idx))
+    modin_series = pd.Series(data, index=modin_idx)
+    pandas_series = pandas.Series(data, index=pandas_idx)
+    modin_result = modin_series.tz_convert("UTC", axis=0)
+    pandas_result = pandas_series.tz_convert("UTC", axis=0)
+    df_equals(modin_result, pandas_result)
+
+    modin_multi = pd.MultiIndex.from_arrays([modin_idx, range(len(modin_idx))])
+    pandas_multi = pandas.MultiIndex.from_arrays([pandas_idx, range(len(modin_idx))])
+    modin_series = pd.Series(data, index=modin_multi)
+    pandas_series = pandas.Series(data, index=pandas_multi)
+    df_equals(
+        modin_series.tz_convert("UTC", axis=0, level=0),
+        pandas_series.tz_convert("UTC", axis=0, level=0),
+    )
 
 
 def test_tz_localize():