-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: astype to string modifying input array inplace #51073
Conversation
pandas/core/arrays/string_.py
Outdated
# modifying input inplace | ||
inferred = lib.infer_dtype(scalars, skipna=False) | ||
if inferred != "string": | ||
copy = True | ||
result = lib.ensure_string_array(scalars, na_value=libmissing.NA, copy=copy) |
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.
can we do this fix in ensure_string_array? ive been hoping to simplify it to make it always take an ndarray.
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 sure, was not sure if this was intended or not. Moved to Cython and improved performance as well
Thanks! |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.inferring is faster than copying in all cases.