@@ -333,11 +333,12 @@ def from_tuples(
333
333
# --------------------------------------------------------------------
334
334
335
335
@Appender (Index ._shallow_copy .__doc__ )
336
- def _shallow_copy (self , left = None , right = None , ** kwargs ):
337
- result = self ._data ._shallow_copy (left = left , right = right )
336
+ def _shallow_copy (self , values = None , ** kwargs ):
337
+ if values is None :
338
+ values = self ._data
338
339
attributes = self ._get_attributes_dict ()
339
340
attributes .update (kwargs )
340
- return self ._simple_new (result , ** attributes )
341
+ return self ._simple_new (values , ** attributes )
341
342
342
343
@cache_readonly
343
344
def _isnan (self ):
@@ -407,7 +408,7 @@ def astype(self, dtype, copy=True):
407
408
with rewrite_exception ("IntervalArray" , type (self ).__name__ ):
408
409
new_values = self .values .astype (dtype , copy = copy )
409
410
if is_interval_dtype (new_values ):
410
- return self ._shallow_copy (new_values . left , new_values . right )
411
+ return self ._shallow_copy (new_values )
411
412
return Index .astype (self , dtype , copy = copy )
412
413
413
414
@property
@@ -881,7 +882,8 @@ def where(self, cond, other=None):
881
882
if other is None :
882
883
other = self ._na_value
883
884
values = np .where (cond , self .values , other )
884
- return self ._shallow_copy (values )
885
+ result = IntervalArray (values )
886
+ return self ._shallow_copy (result )
885
887
886
888
def delete (self , loc ):
887
889
"""
@@ -893,7 +895,8 @@ def delete(self, loc):
893
895
"""
894
896
new_left = self .left .delete (loc )
895
897
new_right = self .right .delete (loc )
896
- return self ._shallow_copy (new_left , new_right )
898
+ result = self ._data ._shallow_copy (new_left , new_right )
899
+ return self ._shallow_copy (result )
897
900
898
901
def insert (self , loc , item ):
899
902
"""
@@ -927,7 +930,8 @@ def insert(self, loc, item):
927
930
928
931
new_left = self .left .insert (loc , left_insert )
929
932
new_right = self .right .insert (loc , right_insert )
930
- return self ._shallow_copy (new_left , new_right )
933
+ result = self ._data ._shallow_copy (new_left , new_right )
934
+ return self ._shallow_copy (result )
931
935
932
936
@Appender (_index_shared_docs ["take" ] % _index_doc_kwargs )
933
937
def take (self , indices , axis = 0 , allow_fill = True , fill_value = None , ** kwargs ):
0 commit comments