-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Series.groupby.size returning int64 for masked and arrow types #54132
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
@@ -2890,12 +2891,21 @@ def size(self) -> DataFrame | Series: | |||
Freq: MS, dtype: int64 | |||
""" | |||
result = self.grouper.size() | |||
result_dtype: str | np.dtype = result.dtype | |||
if isinstance(self.obj, Series): |
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 just use convert_dtypes for this? I think you've got another PR doing something similar for another method?
(i actually think for methods that return ints-and-never-NAs it is more useful to return non-nullable dtype, but whatever)
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 just use convert_dtypes for this?
Sure, I will still have to do this original-object introspection though to set the correct dtype_backend
for convert_dtype
if that's alright with you
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.
either way i guess
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.
Used convert_dtypes
instead
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
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.