@@ -1669,7 +1669,7 @@ def restore_dropped_levels_multijoin(
1669
1669
Returns the levels, labels and names of a multi-index to multi-index join.
1670
1670
Depending on the type of join, this method restores the appropriate
1671
1671
dropped levels of the joined multi-index.
1672
- The method relies on lidx , rindexer which hold the index positions of
1672
+ The method relies on lindexer , rindexer which hold the index positions of
1673
1673
left and right, where a join was feasible
1674
1674
1675
1675
Parameters
@@ -1715,15 +1715,6 @@ def _convert_to_multiindex(index: Index) -> MultiIndex:
1715
1715
join_codes = join_index .codes
1716
1716
join_names = join_index .names
1717
1717
1718
- # lindexer and rindexer hold the indexes where the join occurred
1719
- # for left and right respectively. If left/right is None then
1720
- # the join occurred on all indices of left/right
1721
- if lindexer is None :
1722
- lindexer = range (left .size )
1723
-
1724
- if rindexer is None :
1725
- rindexer = range (right .size )
1726
-
1727
1718
# Iterate through the levels that must be restored
1728
1719
for dropped_level_name in dropped_level_names :
1729
1720
if dropped_level_name in left .names :
@@ -1740,7 +1731,10 @@ def _convert_to_multiindex(index: Index) -> MultiIndex:
1740
1731
# Inject -1 in the codes list where a join was not possible
1741
1732
# IOW indexer[i]=-1
1742
1733
codes = idx .codes [name_idx ]
1743
- restore_codes = algos .take_nd (codes , indexer , fill_value = - 1 )
1734
+ if indexer is None :
1735
+ restore_codes = codes
1736
+ else :
1737
+ restore_codes = algos .take_nd (codes , indexer , fill_value = - 1 )
1744
1738
1745
1739
join_levels = join_levels + [restore_levels ]
1746
1740
join_codes = join_codes + [restore_codes ]
0 commit comments