@@ -146,17 +146,13 @@ class IntervalIndex(IntervalMixin, Index):
146
146
_mask = None
147
147
148
148
def __new__ (cls , data , closed = None , dtype = None , copy = False ,
149
- name = None , fastpath = False , verify_integrity = True ):
150
-
151
- if fastpath :
152
- return cls ._simple_new (data , name )
149
+ name = None , verify_integrity = True ):
153
150
154
151
if name is None and hasattr (data , 'name' ):
155
152
name = data .name
156
153
157
154
with rewrite_exception ("IntervalArray" , cls .__name__ ):
158
155
array = IntervalArray (data , closed = closed , copy = copy , dtype = dtype ,
159
- fastpath = fastpath ,
160
156
verify_integrity = verify_integrity )
161
157
162
158
return cls ._simple_new (array , name )
@@ -187,14 +183,6 @@ def _shallow_copy(self, left=None, right=None, **kwargs):
187
183
attributes .update (kwargs )
188
184
return self ._simple_new (result , ** attributes )
189
185
190
- @cache_readonly
191
- def hasnans (self ):
192
- """
193
- Return if the IntervalIndex has any nans; enables various performance
194
- speedups
195
- """
196
- return self ._isnan .any ()
197
-
198
186
@cache_readonly
199
187
def _isnan (self ):
200
188
"""Return a mask indicating if each value is NA"""
@@ -206,10 +194,6 @@ def _isnan(self):
206
194
def _engine (self ):
207
195
return IntervalTree (self .left , self .right , closed = self .closed )
208
196
209
- @property
210
- def _constructor (self ):
211
- return type (self )
212
-
213
197
def __contains__ (self , key ):
214
198
"""
215
199
return a boolean if this key is IN the index
@@ -394,18 +378,7 @@ def _values(self):
394
378
395
379
@cache_readonly
396
380
def _ndarray_values (self ):
397
- left = self .left
398
- right = self .right
399
- mask = self ._isnan
400
- closed = self .closed
401
-
402
- result = np .empty (len (left ), dtype = object )
403
- for i in range (len (left )):
404
- if mask [i ]:
405
- result [i ] = np .nan
406
- else :
407
- result [i ] = Interval (left [i ], right [i ], closed )
408
- return result
381
+ return np .array (self ._data )
409
382
410
383
def __array__ (self , result = None ):
411
384
""" the array interface, return my values """
@@ -892,18 +865,12 @@ def take(self, indices, axis=0, allow_fill=True,
892
865
return self ._simple_new (result , ** attributes )
893
866
894
867
def __getitem__ (self , value ):
895
- mask = self ._isnan [value ]
896
- if is_scalar (mask ) and mask :
897
- return self ._na_value
898
-
899
- left = self .left [value ]
900
- right = self .right [value ]
901
-
902
- # scalar
903
- if not isinstance (left , Index ):
904
- return Interval (left , right , self .closed )
905
-
906
- return self ._shallow_copy (left , right )
868
+ result = self ._data [value ]
869
+ if isinstance (result , IntervalArray ):
870
+ return self ._shallow_copy (result )
871
+ else :
872
+ # scalar
873
+ return result
907
874
908
875
# __repr__ associated methods are based on MultiIndex
909
876
0 commit comments