Skip to content

Commit 6c3755b

Browse files
committed
Merge pull request #6486 from jreback/reindex
PERF: perf improvements in single-dtyped indexing (GH6484)
2 parents 0364bae + 9e4376d commit 6c3755b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/source/release.rst

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Improvements to existing features
129129
using ``DataFrame.to_csv`` (:issue:`5414`, :issue:`4528`)
130130
- perf improvements in DataFrame construction with certain offsets, by removing faulty caching
131131
(e.g. MonthEnd,BusinessMonthEnd), (:issue:`6479`)
132+
- perf improvements in single-dtyped indexing (:issue:`6484`)
132133

133134
.. _release.bug_fixes-0.14.0:
134135

pandas/core/internals.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3402,8 +3402,11 @@ def reindex_items(self, new_items, indexer=None, copy=True,
34023402
# unique
34033403
if self.axes[0].is_unique and new_items.is_unique:
34043404

3405+
# ok to use the global indexer if only 1 block
3406+
i = indexer if len(self.blocks) == 1 else None
3407+
34053408
for block in self.blocks:
3406-
blk = block.reindex_items_from(new_items, copy=copy)
3409+
blk = block.reindex_items_from(new_items, indexer=i, copy=copy)
34073410
new_blocks.extend(_valid_blocks(blk))
34083411

34093412
# non-unique

0 commit comments

Comments
 (0)