Skip to content

CLN: remove index keyword from _wrap_aggregated_output #41128

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 6 commits into from
Apr 26, 2021

Conversation

jbrockmendel
Copy link
Member

No description provided.

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.

This looks really great, minor comment


name = self.obj.name
index = self.grouper.result_index
values = list(output.values())[0]
Copy link
Member

Choose a reason for hiding this comment

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

Tiny perf boost by not creating the intermediate list

d = {'a': 1}
%timeit list(d.values())[0]
%timeit next(iter(d.values()))

gives

219 ns ± 0.363 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
146 ns ± 22.8 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea, updated

result = self._wrap_series_output(output=output, index=self.obj.index)

name = self.obj.name
values = list(output.values())[0]
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the next trick can work here too.

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

@jreback jreback added this to the 1.3 milestone Apr 26, 2021
@jreback jreback merged commit d4b2103 into pandas-dev:master Apr 26, 2021
@jreback
Copy link
Contributor

jreback commented Apr 26, 2021

nice!

@jbrockmendel jbrockmendel deleted the ref-gbop-wrap branch April 26, 2021 14:27
yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request May 6, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
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.

4 participants