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 @@ -879,6 +879,7 @@ Datetimelike
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning ``False`` on double-digit frequencies (:issue:`58523`)
- Bug in :meth:`DatetimeIndex.union` and :meth:`DatetimeIndex.intersection` when ``unit`` was non-nanosecond (:issue:`59036`)
- Bug in :meth:`Index.union` with a ``pyarrow`` timestamp dtype incorrectly returning ``object`` dtype (:issue:`58421`)
- Bug in :meth:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
- Bug in :meth:`to_datetime` not respecting dayfirst if an uncommon date string was passed. (:issue:`58859`)
- Bug in :meth:`to_datetime` on float array with missing values throwing ``FloatingPointError`` (:issue:`58419`)
Expand Down
6 changes: 5 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5042,9 +5042,13 @@ def _get_join_target(self) -> np.ndarray:
if isinstance(self._values, BaseMaskedArray):
# This is only used if our array is monotonic, so no NAs present
return self._values._data
elif isinstance(self._values, ArrowExtensionArray):
elif (
isinstance(self._values, ArrowExtensionArray)
and self.dtype.kind not in "mM"
):
# This is only used if our array is monotonic, so no missing values
# present
# "mM" cases will go through _get_engine_target and cast to i8
return self._values.to_numpy()

# TODO: exclude ABCRangeIndex case here as it copies
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/indexes/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest

from pandas._libs import lib
import pandas.util._test_decorators as td

from pandas.core.dtypes.cast import find_common_type

Expand Down Expand Up @@ -973,3 +974,13 @@ def test_union_string_array(self, any_string_dtype):
result = idx1.union(idx2)
expected = Index(["a", "b"], dtype=any_string_dtype)
tm.assert_index_equal(result, expected)

@td.skip_if_no("pyarrow")
def test_union_pyarrow_timestamp(self):
# GH#58421
left = Index(["2020-01-01"], dtype="timestamp[s][pyarrow]")
right = Index(["2020-01-02"], dtype="timestamp[s][pyarrow]")

res = left.union(right)
expected = Index(["2020-01-01", "2020-01-02"], dtype=left.dtype)
tm.assert_index_equal(res, expected)
Loading