@@ -333,11 +333,12 @@ def from_tuples(
333333 # --------------------------------------------------------------------
334334
335335 @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
338339 attributes = self ._get_attributes_dict ()
339340 attributes .update (kwargs )
340- return self ._simple_new (result , ** attributes )
341+ return self ._simple_new (values , ** attributes )
341342
342343 @cache_readonly
343344 def _isnan (self ):
@@ -407,7 +408,7 @@ def astype(self, dtype, copy=True):
407408 with rewrite_exception ("IntervalArray" , type (self ).__name__ ):
408409 new_values = self .values .astype (dtype , copy = copy )
409410 if is_interval_dtype (new_values ):
410- return self ._shallow_copy (new_values . left , new_values . right )
411+ return self ._shallow_copy (new_values )
411412 return Index .astype (self , dtype , copy = copy )
412413
413414 @property
@@ -881,7 +882,8 @@ def where(self, cond, other=None):
881882 if other is None :
882883 other = self ._na_value
883884 values = np .where (cond , self .values , other )
884- return self ._shallow_copy (values )
885+ result = IntervalArray (values )
886+ return self ._shallow_copy (result )
885887
886888 def delete (self , loc ):
887889 """
@@ -893,7 +895,8 @@ def delete(self, loc):
893895 """
894896 new_left = self .left .delete (loc )
895897 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 )
897900
898901 def insert (self , loc , item ):
899902 """
@@ -927,7 +930,8 @@ def insert(self, loc, item):
927930
928931 new_left = self .left .insert (loc , left_insert )
929932 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 )
931935
932936 @Appender (_index_shared_docs ["take" ] % _index_doc_kwargs )
933937 def take (self , indices , axis = 0 , allow_fill = True , fill_value = None , ** kwargs ):
0 commit comments