-
-
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: Groupby not keeping object dtype when infer string is set #55620
Conversation
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.
Looks good
@@ -1904,8 +1904,7 @@ def _agg_py_fallback( | |||
ser = Series(values, copy=False) | |||
else: | |||
# We only get here with values.dtype == object | |||
# TODO: special case not needed with ArrayManager | |||
df = DataFrame(values.T) | |||
df = DataFrame(values.T, dtype=values.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.
Perhaps slightly out of scope, but I think it'd be good to add an assert on values.dtype == object here
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.
Yeah I'd rather keep this out of here
Is this a regression with no related issue? |
I am working on a build that uses arrow backed strings by default, but this turns up dozens of bugs related to either the new string dtype we added for 2.1 or arrow strings more generally, not opening issues since I am fixing them when I come across them |
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.
lgtm
Thanks @phofl |
…hen infer string is set
…type when infer string is set) (#55629) Backport PR #55620: BUG: Groupby not keeping object dtype when infer string is set Co-authored-by: Patrick Hoefler <[email protected]>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.