Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add warning to.groupby when null keys would be dropped due to defaultdropna#61351

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
tehunter wants to merge10 commits intopandas-dev:main
base:main
Choose a base branch
Loading
fromtehunter:groupby-dropna-warning

Conversation

tehunter
Copy link
Contributor

@tehuntertehunter commentedApr 24, 2025
edited
Loading

TODO:

  • Check performance forcodes check approaches (codes.min() was about 3x faster)
  • Run full test suite to ensure nothing broke
  • Add tests/implementation for.pivot_table/.stack/etc. (possibly in a follow-up PR?)

Comment on lines +64 to +68
_NULL_KEY_MESSAGE = (
"`dropna` is not specified but grouper encountered null group keys. These keys "
"will be dropped from the result by default. To keep null keys, set `dropna=True`, "
"or to hide this warning and drop null keys, set `dropna=False`."
)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Is this a standard approach for a warning message that could be hit from two lines of code?

Comment on lines +489 to +493
@property
def dropna(self) -> bool:
if self._dropna is lib.no_default:
return True
return self._dropna
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I know the implementation is trivial, but this is redundant withGrouper. I'm not sure we can get around it while still being a class property, but should the default value be referenced as a constant defined just once?

this will help with PDEP-11 (pandas-dev#53094) as an intermediate step to identify tests that will fail under the default value
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rhshadrachrhshadrachAwaiting requested review from rhshadrachrhshadrach will be requested when the pull request is marked ready for reviewrhshadrach is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

ENH: Add warning whenDataFrame.groupby drops NA keys
1 participant
@tehunter

[8]ページ先頭

©2009-2025 Movatter.jp