@@ -802,56 +802,6 @@ def _format_data(self, name=None) -> str:
802
802
# name argument is unused here; just for compat with base / categorical
803
803
return self ._data ._format_data () + "," + self ._format_space ()
804
804
805
- # --------------------------------------------------------------------
806
- # Set Operations
807
-
808
- def _intersection (self , other , sort ):
809
- """
810
- intersection specialized to the case with matching dtypes.
811
- """
812
- # For IntervalIndex we also know other.closed == self.closed
813
- if self .left .is_unique and self .right .is_unique :
814
- return super ()._intersection (other , sort = sort )
815
- elif other .left .is_unique and other .right .is_unique and self .isna ().sum () <= 1 :
816
- # Swap other/self if other is unique and self does not have
817
- # multiple NaNs
818
- return super ()._intersection (other , sort = sort )
819
- else :
820
- # duplicates
821
- taken = self ._intersection_non_unique (other )
822
-
823
- if sort is None :
824
- taken = taken .sort_values ()
825
-
826
- return taken
827
-
828
- def _intersection_non_unique (self , other : IntervalIndex ) -> IntervalIndex :
829
- """
830
- Used when the IntervalIndex does have some common endpoints,
831
- on either sides.
832
- Return the intersection with another IntervalIndex.
833
-
834
- Parameters
835
- ----------
836
- other : IntervalIndex
837
-
838
- Returns
839
- -------
840
- IntervalIndex
841
- """
842
- mask = np .zeros (len (self ), dtype = bool )
843
-
844
- if self .hasnans and other .hasnans :
845
- first_nan_loc = np .arange (len (self ))[self .isna ()][0 ]
846
- mask [first_nan_loc ] = True
847
-
848
- other_tups = set (zip (other .left , other .right ))
849
- for i , tup in enumerate (zip (self .left , self .right )):
850
- if tup in other_tups :
851
- mask [i ] = True
852
-
853
- return self [mask ]
854
-
855
805
# --------------------------------------------------------------------
856
806
857
807
@property
0 commit comments