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/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ Bug Fixes
- Fixed ``copy()`` to shallow copy axes/indices as well and thereby keep
separate metadata. (:issue:`4202`, :issue:`4830`)
- Fixed skiprows option in Python parser for read_csv (:issue:`4382`)
- Fixed wrong check for overlapping in ``DatetimeIndex.union`` (:issue:`4564`)

pandas 0.12.0
-------------
Expand Down
4 changes: 2 additions & 2 deletions pandas/tseries/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,11 +986,11 @@ def _can_fast_union(self, other):
else:
left, right = other, self

left_end = left[-1]
right_start = right[0]
left_end = left[-1]

# Only need to "adjoin", not overlap
return (left_end + offset) >= right_start
return (right_start == left_end + offset) or right_start in left

def _fast_union(self, other):
if len(other) == 0:
Expand Down
9 changes: 9 additions & 0 deletions pandas/tseries/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,15 @@ def test_union_bug_1745(self):
exp = DatetimeIndex(sorted(set(list(left)) | set(list(right))))
self.assert_(result.equals(exp))

def test_union_bug_4564(self):
from pandas import DateOffset
left = date_range("2013-01-01", "2013-02-01")
right = left + DateOffset(minutes=15)

result = left.union(right)
exp = DatetimeIndex(sorted(set(list(left)) | set(list(right))))
self.assert_(result.equals(exp))

def test_intersection_bug_1708(self):
from pandas import DateOffset
index_1 = date_range('1/1/2012', periods=4, freq='12H')
Expand Down