-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix for issue #12553 #12557
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: Fix for issue #12553 #12557
Conversation
thanks. See the contributing guide here Like to have tests! |
@@ -2790,6 +2790,10 @@ def true_and_notnull(x, *args, **kwargs): | |||
def nunique(self, dropna=True): | |||
""" Returns number of unique elements in the group """ | |||
ids, _, _ = self.grouper.group_info | |||
|
|||
if len(ids) == 0: # bufix for 12553 | |||
return 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.
This should just be self._constructor
, so objects that inherit can keep their type
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.
Using self._constructor
causes an error for me. And the already existing return
returns a Series() anyway. I don't understand the reason to change this.
in the future, no need to open a NEW pull-request, just force push to the old one. |
closes #12553