Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ Timedelta
Timezones
^^^^^^^^^
- Bug in :meth:`DatetimeIndex.union`, :meth:`DatetimeIndex.intersection`, and :meth:`DatetimeIndex.symmetric_difference` changing timezone to UTC when merging two DatetimeIndex objects with the same timezone but different units (:issue:`60080`)
- Bug in :meth:`Series.dt.tz_localize` with a timezone-aware :class:`ArrowDtype` incorrectly converting to UTC when ``tz=None`` (:issue:`61780`)
-

Numeric
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,7 @@ def _dt_tz_localize(
if nonexistent_pa is None:
raise NotImplementedError(f"{nonexistent=} is not supported")
if tz is None:
result = self._pa_array.cast(pa.timestamp(self.dtype.pyarrow_dtype.unit))
result = pc.local_timestamp(self._pa_array)
else:
result = pc.assume_timezone(
self._pa_array, str(tz), ambiguous=ambiguous, nonexistent=nonexistent_pa
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2679,8 +2679,9 @@ def test_dt_tz_localize_unsupported_tz_options():
ser.dt.tz_localize("UTC", nonexistent="NaT")


@pytest.mark.xfail(reason="Converts to UTC before localizing GH#61780")
def test_dt_tz_localize_none():
def test_dt_tz_localize_none(request):
_require_timezone_database(request)

ser = pd.Series(
[datetime(year=2023, month=1, day=2, hour=3), None],
dtype=ArrowDtype(pa.timestamp("ns", tz="US/Pacific")),
Expand Down
Loading