-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
There was a problem hiding this 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
pandas/core/groupby/generic.py
Outdated
|
||
name = self.obj.name | ||
index = self.grouper.result_index | ||
values = list(output.values())[0] |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, updated
pandas/core/groupby/generic.py
Outdated
result = self._wrap_series_output(output=output, index=self.obj.index) | ||
|
||
name = self.obj.name | ||
values = list(output.values())[0] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
nice! |
No description provided.