Skip to content

Commit 709e45e

Browse files
committed
PERF: take the fast path on a reindex when reindexers are identical
1 parent 0fe98d8 commit 709e45e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pandas/core/generic.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1545,13 +1545,6 @@ def reindex(self, *args, **kwargs):
15451545

15461546
self._consolidate_inplace()
15471547

1548-
# check if we are a multi reindex
1549-
if self._needs_reindex_multi(axes, method, level):
1550-
try:
1551-
return self._reindex_multi(axes, copy, fill_value)
1552-
except:
1553-
pass
1554-
15551548
# if all axes that are requested to reindex are equal, then only copy
15561549
# if indicated must have index names equal here as well as values
15571550
if all([self._get_axis(axis).identical(ax)
@@ -1560,6 +1553,13 @@ def reindex(self, *args, **kwargs):
15601553
return self.copy()
15611554
return self
15621555

1556+
# check if we are a multi reindex
1557+
if self._needs_reindex_multi(axes, method, level):
1558+
try:
1559+
return self._reindex_multi(axes, copy, fill_value)
1560+
except:
1561+
pass
1562+
15631563
# perform the reindex on the axes
15641564
return self._reindex_axes(axes, level, limit,
15651565
method, fill_value, copy,

0 commit comments

Comments
 (0)