From 716beaecb33881996fe2eee9271c3b6416af4d3a Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 9 Sep 2022 19:18:36 +0200 Subject: [PATCH] Backport PR #48472: PERF: keep using ObjectEngine for ExtensionArrays for 1.5 --- pandas/core/indexes/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 91c658a4cef5d..ace3df3ae97a4 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -5154,6 +5154,9 @@ def _get_engine_target(self) -> ArrayLike: if isinstance(vals, StringArray): # GH#45652 much more performant than ExtensionEngine return vals._ndarray + if type(self) is Index and isinstance(self._values, ExtensionArray): + # TODO(ExtensionIndex): remove special-case, just use self._values + return self._values.astype(object) return vals def _from_join_target(self, result: np.ndarray) -> ArrayLike: