File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,9 @@ def setup(self, N):
196196 self .intv  =  IntervalIndex .from_arrays (left , right )
197197 self .intv ._engine 
198198
199+  self .intv2  =  IntervalIndex .from_arrays (left  +  1 , right  +  1 )
200+  self .intv2 ._engine 
201+ 
199202 self .left  =  IntervalIndex .from_breaks (np .arange (N ))
200203 self .right  =  IntervalIndex .from_breaks (np .arange (N  -  3 , 2  *  N  -  3 ))
201204
@@ -208,8 +211,11 @@ def time_is_unique(self, N):
208211 def  time_intersection (self , N ):
209212 self .left .intersection (self .right )
210213
211-  def  time_intersection_duplicate (self , N ):
214+  def  time_intersection_one_duplicate (self , N ):
212215 self .intv .intersection (self .right )
213216
217+  def  time_intersection_both_duplicate (self , N ):
218+  self .intv .intersection (self .intv2 )
219+ 
214220
215221from  .pandas_vb_common  import  setup  # noqa: F401 
Original file line number Diff line number Diff line change @@ -1143,6 +1143,11 @@ def overlaps(self, other):
11431143 def  intersection (self , other , sort = False ):
11441144 if  self .left .is_unique  and  self .right .is_unique :
11451145 taken  =  self ._intersection_unique (other )
1146+  elif  (other .left .is_unique  and  other .right .is_unique  and 
1147+  self .isna ().sum () <=  1 ):
1148+  # Swap other/self if other is unique and self does not have 
1149+  # multiple NaNs 
1150+  taken  =  other ._intersection_unique (self )
11461151 else :
11471152 # duplicates 
11481153 taken  =  self ._intersection_non_unique (other )
                         You can’t perform that action at this time. 
           
                  
0 commit comments