Skip to content

Commit c3de83f

Browse files
committed
BUG: Fix timezone handling in DatetimeIndex.union (pandas-dev#60080)
1 parent 8927261 commit c3de83f

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

Diff for: pandas/tests/indexes/datetimes/test_setops.py

+17-16
Original file line numberDiff line numberDiff line change
@@ -754,19 +754,20 @@ def test_union_same_timezone_same_resolution():
754754
).astype("datetime64[ms, UTC+05:00]")
755755
tm.assert_index_equal(result, expected)
756756

757-
def test_union_single_entry():
758-
"""
759-
GH 60080: Ensure union of single-entry DatetimeIndex works as expected
760-
with different units and same timezone.
761-
"""
762-
idx1 = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
763-
"datetime64[ms, UTC+05:00]"
764-
)
765-
idx2 = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
766-
"datetime64[us, UTC+05:00]"
767-
)
768-
result = idx1.union(idx2)
769-
expected = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
770-
"datetime64[us, UTC+05:00]"
771-
)
772-
tm.assert_index_equal(result, expected)
757+
758+
def test_union_single_entry():
759+
"""
760+
GH 60080: Ensure union of single-entry DatetimeIndex works as expected
761+
with different units and same timezone.
762+
"""
763+
idx1 = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
764+
"datetime64[ms, UTC+05:00]"
765+
)
766+
idx2 = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
767+
"datetime64[us, UTC+05:00]"
768+
)
769+
result = idx1.union(idx2)
770+
expected = DatetimeIndex(["2023-01-01 10:00:00+05:00"]).astype(
771+
"datetime64[us, UTC+05:00]"
772+
)
773+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)