File tree 3 files changed +12
-2
lines changed
3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -472,6 +472,7 @@ Bug Fixes
472
472
- Fixed skiprows option in Python parser for read_csv (:issue: `4382 `)
473
473
- Fixed bug preventing ``cut `` from working with ``np.inf `` levels without
474
474
explicitly passing labels (:issue: `3415 `)
475
+ - Fixed wrong check for overlapping in ``DatetimeIndex.union `` (:issue: `4564 `)
475
476
476
477
pandas 0.12.0
477
478
-------------
Original file line number Diff line number Diff line change @@ -986,11 +986,11 @@ def _can_fast_union(self, other):
986
986
else :
987
987
left , right = other , self
988
988
989
- left_end = left [- 1 ]
990
989
right_start = right [0 ]
990
+ left_end = left [- 1 ]
991
991
992
992
# Only need to "adjoin", not overlap
993
- return (left_end + offset ) >= right_start
993
+ return (right_start == left_end + offset ) or right_start in left
994
994
995
995
def _fast_union (self , other ):
996
996
if len (other ) == 0 :
Original file line number Diff line number Diff line change @@ -1859,6 +1859,15 @@ def test_union_bug_1745(self):
1859
1859
exp = DatetimeIndex (sorted (set (list (left )) | set (list (right ))))
1860
1860
self .assert_ (result .equals (exp ))
1861
1861
1862
+ def test_union_bug_4564 (self ):
1863
+ from pandas import DateOffset
1864
+ left = date_range ("2013-01-01" , "2013-02-01" )
1865
+ right = left + DateOffset (minutes = 15 )
1866
+
1867
+ result = left .union (right )
1868
+ exp = DatetimeIndex (sorted (set (list (left )) | set (list (right ))))
1869
+ self .assert_ (result .equals (exp ))
1870
+
1862
1871
def test_intersection_bug_1708 (self ):
1863
1872
from pandas import DateOffset
1864
1873
index_1 = date_range ('1/1/2012' , periods = 4 , freq = '12H' )
You can’t perform that action at this time.
0 commit comments