-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: translate losing object dtype with new string dtype #56152
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
@@ -2317,7 +2318,8 @@ def translate(self, table): | |||
dtype: object | |||
""" | |||
result = self._data.array._str_translate(table) | |||
return self._wrap_result(result) | |||
dtype = object if self._data.dtype == "object" else None | |||
return self._wrap_result(result, dtype=dtype) |
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.
Maybe dumb question, but we can't just pass dtype=self._data.dtype
and have the result dtype be correct in _wrap_result
(with maybe additional logic)?
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.
Categoricals act out then, that's a bit confusing to me as well, but I didn't want to focus on this now.
Thanks @phofl |
Sorry this was meant for 2.1.4, should have added the milestone |
@meeseeksdev backport 2.1.x |
… new string dtype
…e with new string dtype) (#56185) Backport PR #56152: BUG: translate losing object dtype with new string dtype Co-authored-by: Patrick Hoefler <[email protected]>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.