-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: StringArray from np.str_ array #49109
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
Conversation
pandas/_libs/lib.pyx
Outdated
@@ -703,6 +703,10 @@ cpdef ndarray[object] ensure_string_array( | |||
if copy and result is arr: | |||
result = result.copy() | |||
|
|||
if util.is_array(arr) and issubclass(arr.dtype.type, np.str_): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the np.aasarray
call above guarantee util.is_array(arr)
is always true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, you're right. I've removed the is_array check. thanks!
Thanks @lukemanley |
* perf: string array from np.str_ * add test * whatsnew * cleanup
doc/source/whatsnew/v2.0.0.rst
file if fixing a bug or adding a new feature.Perf improvement when constructing a
StringArray
from a numpy array with typenp.str_
.