Skip to content

TST: Added test for groupby dropping NA when grouping on columns #50156

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 2 commits into from
Closed

TST: Added test for groupby dropping NA when grouping on columns #50156

wants to merge 2 commits into from

Conversation

pbhoopala
Copy link

@pbhoopala pbhoopala commented Dec 9, 2022

@pbhoopala pbhoopala changed the title TST: Added test for groupby dropping NA when grouping on columns GH21755 TST: Added test for groupby dropping NA when grouping on columns Dec 9, 2022
{"a": [np.nan, "foo", "bar", np.nan, np.nan, "baz"], "b": [0, 1, 2, 3, 4, 5]}
)
result = df.groupby("a").head(1)
expected = DataFrame({"a": ["foo", "bar", "baz"], "b": [1, 2, 5]})
Copy link
Member

Choose a reason for hiding this comment

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

Can you define the index in here as well? No need to set in an extra line.

Also please merge main

Copy link
Author

Choose a reason for hiding this comment

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

I just added a commit which defines the index in the DataFrame constructor, as requested. Also, I have merged the pull request to main.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Can you also test nth? It should have the same output, so can just parameterize the test, e.g.

@pytest.mark.parametrize("method", ["head", "nth"])

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jan 13, 2023
@rhshadrach
Copy link
Member

Closing as stale. @pbhoopala - if you're interested in continuing just comment here and happy to reopen.

@rhshadrach rhshadrach closed this Jan 14, 2023
@luke396 luke396 mentioned this pull request Jan 15, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some groupby methods keep null grouping keys
3 participants