@@ -757,19 +757,13 @@ def _get_join_info(self):
757
757
758
758
if self .right_index :
759
759
if len (self .left ) > 0 :
760
- join_index = self ._create_join_index (self .left .index ,
761
- self .right .index ,
762
- left_indexer ,
763
- how = 'right' )
760
+ join_index = self .left .index .take (left_indexer )
764
761
else :
765
762
join_index = self .right .index .take (right_indexer )
766
763
left_indexer = np .array ([- 1 ] * len (join_index ))
767
764
elif self .left_index :
768
765
if len (self .right ) > 0 :
769
- join_index = self ._create_join_index (self .right .index ,
770
- self .left .index ,
771
- right_indexer ,
772
- how = 'left' )
766
+ join_index = self .right .index .take (right_indexer )
773
767
else :
774
768
join_index = self .left .index .take (left_indexer )
775
769
right_indexer = np .array ([- 1 ] * len (join_index ))
@@ -780,37 +774,6 @@ def _get_join_info(self):
780
774
join_index = join_index .astype (object )
781
775
return join_index , left_indexer , right_indexer
782
776
783
- def _create_join_index (self , index , other_index , indexer , how = 'left' ):
784
- """
785
- Create a join index by rearranging one index to match another
786
-
787
- Parameters
788
- ----------
789
- index: Index being rearranged
790
- other_index: Index used to supply values not found in index
791
- indexer: how to rearrange index
792
- how: replacement is only necessary if indexer based on other_index
793
-
794
- Returns
795
- -------
796
- join_index
797
- """
798
- join_index = index .take (indexer )
799
- if (self .how in (how , 'outer' ) and
800
- not isinstance (other_index , MultiIndex )):
801
- # if final index requires values in other_index but not target
802
- # index, indexer may hold missing (-1) values, causing Index.take
803
- # to take the final value in target index
804
- mask = indexer == - 1
805
- if np .any (mask ):
806
- # if values missing (-1) from target index,
807
- # take from other_index instead
808
- join_list = join_index .to_numpy ()
809
- join_list [mask ] = other_index .to_numpy ()[mask ]
810
- join_index = Index (join_list , dtype = join_index .dtype ,
811
- name = join_index .name )
812
- return join_index
813
-
814
777
def _get_merge_keys (self ):
815
778
"""
816
779
Note: has side effects (copy/delete key columns)
0 commit comments