Repository: modin-project/modin

Issue:
New API: `tz_localize` for Series and DataFrame

### Describe the problem
<!-- Describe the problem clearly here. -->
`tz_localize` only affects the index/columns, so it should be trivial to implement. 



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
@@ -3161,15 +3161,20 @@ def tz_convert(self, tz, axis=0, level=None, copy=True):
     def tz_localize(
         self, tz, axis=0, level=None, copy=True, ambiguous="raise", nonexistent="raise"
     ):
-        return self._default_to_pandas(
-            "tz_localize",
-            tz,
-            axis=axis,
-            level=level,
-            copy=copy,
-            ambiguous=ambiguous,
-            nonexistent=nonexistent,
+        axis = self._get_axis_number(axis)
+        new_labels = (
+            pandas.Series(index=self.axes[axis])
+            .tz_localize(
+                tz,
+                axis=axis,
+                level=level,
+                copy=False,
+                ambiguous=ambiguous,
+                nonexistent=nonexistent,
+            )
+            .index
         )
+        return self.set_axis(labels=new_labels, axis=axis, inplace=not copy)
 
     def unstack(self, level=-1, fill_value=None):
         return self._default_to_pandas("unstack", level=level, fill_value=fill_value)


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
@@ -2622,11 +2622,17 @@ def test_tz_convert(self):
             df.tz_localize("America/Los_Angeles").tz_convert("America/Los_Angeles")
 
     def test_tz_localize(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)
-
-        with pytest.warns(UserWarning):
-            df.tz_localize("America/Los_Angeles")
+        idx = pd.date_range("1/1/2012", periods=400, freq="2D")
+        data = np.random.randint(0, 100, size=(len(idx), 4))
+        modin_df = pd.DataFrame(data, index=idx)
+        pandas_df = pandas.DataFrame(data, index=idx)
+        df_equals(
+            modin_df.tz_localize("UTC", axis=0), pandas_df.tz_localize("UTC", axis=0)
+        )
+        df_equals(
+            modin_df.tz_localize("America/Los_Angeles", axis=0),
+            pandas_df.tz_localize("America/Los_Angeles", axis=0),
+        )
 
     def test_unstack(self):
         data = test_data_values[0]
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
@@ -2607,10 +2607,17 @@ def test_tz_convert():
 
 
 def test_tz_localize():
-    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")
+    idx = pd.date_range("1/1/2012", periods=400, freq="2D")
+    data = np.random.randint(0, 100, size=len(idx))
+    modin_series = pd.Series(data, index=idx)
+    pandas_series = pandas.Series(data, index=idx)
+    df_equals(
+        modin_series.tz_localize("America/Los_Angeles"),
+        pandas_series.tz_localize("America/Los_Angeles"),
+    )
+    df_equals(
+        modin_series.tz_localize("UTC"), pandas_series.tz_localize("UTC"),
+    )
 
 
 @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)