Commit e6f4096
committed
BUG: Fix index.union failure at DST boundary (GH#62915)
When concatenating DatetimeIndex objects across DST transitions, the
frequency preservation logic was using naive addition that didn't account
for timezone offsets changing at DST boundaries. This caused the assertion
`pair[0][-1] + obj.freq == pair[1][0]` to fail even when the indexes
were legitimately consecutive.
For fixed (Tick) frequencies like Day, Hour, etc., the fix compares the
underlying int64 values (UTC nanoseconds) instead of relying on timezone-aware
arithmetic. This correctly identifies consecutive timestamps regardless of
DST transitions.
For non-fixed frequencies like MonthEnd or BusinessDay, the code falls back
to the original comparison method since freq.nanos is not available for
these offset types.
Closes #629151 parent 5641979 commit e6f4096
File tree
2 files changed
+30
-1
lines changed- pandas
- core/arrays
- tests/indexes/datetimes
2 files changed
+30
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2383 | 2383 | | |
2384 | 2384 | | |
2385 | 2385 | | |
2386 | | - | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
2387 | 2404 | | |
2388 | 2405 | | |
2389 | 2406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
732 | 744 | | |
733 | 745 | | |
734 | 746 | | |
| |||
0 commit comments