Skip to content

Commit 70d0f17

Browse files
mroeschkepmhatre1
authored andcommitted
PERF: Skip _shallow_copy for RangeIndex._join_empty where other is RangeIndex (pandas-dev#57855)
1 parent 94a4c51 commit 70d0f17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/indexes/range.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def symmetric_difference(
943943
def _join_empty(
944944
self, other: Index, how: JoinHow, sort: bool
945945
) -> tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]:
946-
if other.dtype.kind == "i":
946+
if not isinstance(other, RangeIndex) and other.dtype.kind == "i":
947947
other = self._shallow_copy(other._values, name=other.name)
948948
return super()._join_empty(other, how=how, sort=sort)
949949

0 commit comments

Comments
 (0)