Skip to content
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

PERF: support mask in group_last #46107

Merged
merged 1 commit into from
Feb 26, 2022
Merged

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Feb 21, 2022

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

xref #37493

We have existing tests with MaskedArrays for this.

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Looks good. What's the perf diff for groupby.last?

Also the xref link doesn't seem to exist.

@mroeschke mroeschke added Groupby Performance Memory or execution speed performance labels Feb 22, 2022
@mroeschke mroeschke added this to the 1.5 milestone Feb 22, 2022
@jbrockmendel
Copy link
Member Author

ser = pd.Series(range(10**5), dtype="Int64")
df = pd.DataFrame({"A": 1, "B": ser})
gb = df.groupby("A")

%timeit gb.last()
726 µs ± 26 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)  # <- main
527 µs ± 3.88 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)  # <- PR

Also the xref link doesn't seem to exist.

Fixed.

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM. Probably worth whatsnew in a followup as well.

@jreback jreback merged commit d673e5a into pandas-dev:main Feb 26, 2022
@jreback
Copy link
Contributor

jreback commented Feb 26, 2022

sure assume first is an easy followup

@jbrockmendel jbrockmendel deleted the perf-gb branch February 26, 2022 21:52
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants