Skip to content

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

Closed
wants to merge 6 commits into from
Closed

BUG: Fix for issue #12553 #12557

wants to merge 6 commits into from

Conversation

thanasis2028
Copy link

closes #12553

@jreback
Copy link
Contributor

jreback commented Mar 7, 2016

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([])
Copy link
Contributor

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

Copy link
Author

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.

@jreback
Copy link
Contributor

jreback commented Mar 8, 2016

in the future, no need to open a NEW pull-request, just force push to the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SeriesGroupby.nunique raises an IndexError on empty Series
3 participants