-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Add numba engine to groupby.aggregate #33388
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
is it worth making a _numba_agg to call instead of adding a clause to python_agg_general? this code is difficult to debug so to the extent things can be isolated thatd be nice |
@jbrockmendel sure I can create a separate |
So by creating a new |
Hello @mroeschke! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-04-24 05:09:27 UTC |
I trust your judgement. |
|
LGTM |
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 good, just a couple of comments.
also for followups
- updating a section in the groupby docs with an example on how to use numba (for rolling as well if we don't have it).
- update doc-string? also IIRC this raises on failures rather than trying to fall back like non-numba .agg, let's note that in doc-string & in the groupby docs (as a warning i think).
- cleanups as noted
): | ||
|
||
if engine == "numba": | ||
nopython, nogil, parallel = get_jit_arguments(engine_kwargs) |
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.
can you condense these to a single function call (with whatever return args you need later on)
you can certainly leave these functions individually in core.util.numba_, just when you are calling it would make th api simpler here. (also if you can do this simplification other places we call numba).
can do this in a followup.
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.
Sure can follow up with this cleanup
------- | ||
bool | ||
""" | ||
return "The first" in err_message or "numba does not" in err_message |
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.
can you actually just check the class type here?
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.
I raise ValueError
from the numba utilities, so I need to distinguish between ValueError
s from another op vs the numba utilties.
Should I make a NumbaUtilError(ValueError)
exception? Then we would also need to expose it to users
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.
yes, let's have a separate exception (but in a followon)
Here is some example timeit benchmarks
|
Looks like the the aggregate and transform docstrings are not rendering correctly: https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.aggregate.html#pandas.core.groupby.GroupBy.aggregate I can try to address those in a followup (in addition to adding to the agg docstring). But address updating |
------- | ||
bool | ||
""" | ||
return "The first" in err_message or "numba does not" in err_message |
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.
yes, let's have a separate exception (but in a followon)
thanks @mroeschke very nice. a followon request + plus any refactorings as discussed as follows would be great. |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
In the same spirit of #31845 and #32854, adding
engine
andengine_kwargs
arguments togroupby.aggreate
.This PR has some functionality that is waiting to be merged in #32854