3131
3232from pandas .tseries .offsets import index_offsets_equal
3333import pandas .tseries .frequencies as frequencies
34-
34+ import pandas . core . indexes . api as _api
3535
3636_index_doc_kwargs = dict (ibase ._index_doc_kwargs )
3737
@@ -635,7 +635,8 @@ def intersection(self, other):
635635 self ._assert_can_do_setop (other )
636636
637637 if self .equals (other ):
638- return self ._get_consensus_name (other )
638+ name = _api ._get_consensus_names ((self , other ))[0 ]
639+ return self ._shallow_copy (self , name = name )
639640
640641 lengths = len (self ), len (other )
641642 if lengths [0 ] == 0 :
@@ -648,7 +649,6 @@ def intersection(self, other):
648649 not other ._is_strictly_monotonic )):
649650 result = Index .intersection (self , other )
650651 result = self ._shallow_copy (result ._values , name = result .name ,
651- tz = getattr (self , 'tz' , None ),
652652 freq = None
653653 )
654654 if result .freq is None :
@@ -657,9 +657,9 @@ def intersection(self, other):
657657
658658 # Conditions met!
659659 intersected_slice = self ._fast_intersection (other )
660- intersected = self . _shallow_copy ( intersected_slice )
661- return intersected . _get_consensus_name ( other )
662-
660+ name = _api . _get_consensus_names (( self , other ))[ 0 ]
661+ intersected = self . _shallow_copy ( intersected_slice , name = name )
662+ return intersected
663663
664664def wrap_arithmetic_op (self , other , result ):
665665 if result is NotImplemented :
0 commit comments