Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: Index[StringArray] #46349

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
ExtensionArray,
FloatingArray,
IntegerArray,
PandasArray,
)
from pandas.core.arrays.floating import FloatingDtype
from pandas.core.arrays.integer import IntegerDtype
from pandas.core.arrays.numpy_ import PandasArray
from pandas.core.construction import extract_array
from pandas.core.indexers import check_array_indexer
from pandas.core.missing import isna
Expand Down
7 changes: 6 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
validate_tz_from_dtype,
)
from pandas.core.arrays.sparse import SparseDtype
from pandas.core.arrays.string_ import StringArray
from pandas.core.base import (
IndexOpsMixin,
PandasObject,
Expand Down Expand Up @@ -5032,7 +5033,11 @@ def _get_engine_target(self) -> ArrayLike:
Get the ndarray or ExtensionArray that we can pass to the IndexEngine
constructor.
"""
return self._values
vals = self._values
if isinstance(vals, StringArray):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this true for other EAs? e.g. original report was for Int64

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#45652 was about string dtype. I think Joris commented about Int64 elsewhere and pointed out they are related.

# GH#45652 much more performant than ExtensionEngine
return vals._ndarray
return vals

def _from_join_target(self, result: np.ndarray) -> ArrayLike:
"""
Expand Down