Skip to content

BUG: propagate dropna in pd.Grouper #36604

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 11 commits into from
Sep 26, 2020
Merged

Conversation

arw2019
Copy link
Member

@arw2019 arw2019 commented Sep 24, 2020

A precursor to #35751

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.

lgtm, one small request.

def test_Grouper_dropna_propagation(dropna):
df = pd.DataFrame({"A": [0, 0, 1, None], "B": [1, 2, 3, None]})
gb = df.groupby("A", dropna=dropna)
assert gb.grouper.dropna is dropna
Copy link
Member

Choose a reason for hiding this comment

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

I think use == instead of is here.

Copy link
Member

@rhshadrach rhshadrach Sep 24, 2020

Choose a reason for hiding this comment

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

Also, lowercase g and lets add the PR number here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for looking this over! Fixed both of these

@jreback jreback added this to the 1.2 milestone Sep 24, 2020
@arw2019
Copy link
Member Author

arw2019 commented Sep 25, 2020

I noticed that the Grouper docstring didn't have a dropna arg so I added that here.

I said added in 1.2.0 - a bit of a slight of hand since it the attribute was already there in the code in Grouper (but it didn't exist/propagate in BaseGrouper so it was unusable)

@arw2019 arw2019 changed the title BUG/ENH: add dropna attribute to BaseGrouper and propagate dropna in get_grouper BUG: propagate dropna in Grouper Sep 25, 2020
@arw2019 arw2019 changed the title BUG: propagate dropna in Grouper BUG: propagate dropna in pd.Grouper Sep 25, 2020
@WillAyd
Copy link
Member

WillAyd commented Sep 25, 2020 via email

@jreback jreback merged commit 13f0055 into pandas-dev:master Sep 26, 2020
@jreback
Copy link
Contributor

jreback commented Sep 26, 2020

ok this is fine

kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
@@ -97,6 +98,7 @@ def __init__(
self.group_keys = group_keys
self.mutated = mutated
self.indexer = indexer
self.dropna = dropna
Copy link
Member

Choose a reason for hiding this comment

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

@arw2019 this attribute isnt used anywhere except for in the test added in this PR. is it still needed? is it part of a precursor to something on the horizon?

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.

BUG: Grouper should have a dropna attribute
5 participants