Skip to content

Commit

Permalink
PERF: avoid unnecessary method call in get_indexer_non_unique() on Mu…
Browse files Browse the repository at this point in the history
…ltiIndex (pandas-dev#55811)
  • Loading branch information
morotti committed Nov 7, 2023
1 parent 97c61e8 commit 51f3d03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6036,12 +6036,13 @@ def get_indexer_non_unique(

# Note: _maybe_downcast_for_indexing ensures we never get here
# with MultiIndex self and non-Multi target
tgt_values = target._get_engine_target()
if self._is_multi and target._is_multi:
engine = self._engine
# Item "IndexEngine" of "Union[IndexEngine, ExtensionEngine]" has
# no attribute "_extract_level_codes"
tgt_values = engine._extract_level_codes(target) # type: ignore[union-attr]
else:
tgt_values = target._get_engine_target()

indexer, missing = self._engine.get_indexer_non_unique(tgt_values)
return ensure_platform_int(indexer), ensure_platform_int(missing)
Expand Down

0 comments on commit 51f3d03

Please sign in to comment.