Skip to content

BUG: groupby.nth after selection #53519

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

Merged
merged 1 commit into from
Jun 5, 2023
Merged

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach added Bug Groupby Filters e.g. head, tail, nth labels Jun 4, 2023
@rhshadrach rhshadrach added this to the 2.1 milestone Jun 4, 2023
Comment on lines -3226 to -3232
grouper, _, _ = get_grouper(
dropped,
key=self.keys,
axis=self.axis,
level=self.level,
sort=self.sort,
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When keys is not a BaseGrouper, this would create a new grouper and the caches would then be recomputed meaning no time is really saved. When keys is a BaseGrouper and a null row is dropped the nth operation would raise.

@mroeschke mroeschke merged commit c2b81f2 into pandas-dev:main Jun 5, 2023
@mroeschke
Copy link
Member

Thanks @rhshadrach

@rhshadrach rhshadrach deleted the gb_nth_bug branch June 5, 2023 18:07
topper-123 pushed a commit to topper-123/pandas that referenced this pull request Jun 5, 2023
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Filters e.g. head, tail, nth Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: groupby.nth after selection groupby.nth with dropna is buggy
2 participants