Skip to content

Commit

Permalink
PERF: avoid validating indices repeatedly in ArrayManager.reindex_ind…
Browse files Browse the repository at this point in the history
…exer (#40248)
  • Loading branch information
jorisvandenbossche authored Mar 5, 2021
1 parent ee50197 commit bf270f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pandas/core/internals/array_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@
extract_array,
sanitize_array,
)
from pandas.core.indexers import maybe_convert_indices
from pandas.core.indexers import (
maybe_convert_indices,
validate_indices,
)
from pandas.core.indexes.api import (
Index,
ensure_index,
Expand Down Expand Up @@ -965,8 +968,9 @@ def _reindex_indexer(
new_arrays.append(arr)

else:
validate_indices(indexer, len(self._axes[0]))
new_arrays = [
algos.take(
take_nd(
arr,
indexer,
allow_fill=True,
Expand Down

0 comments on commit bf270f6

Please sign in to comment.