-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
ENH: Add numba engine for rolling apply #30151
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
Changes from 1 commit
3b9bff8
9a302bf
0e9a600
36a77ed
dbb2a9b
f0e9a4d
1250aee
4e7fd1a
cb976cf
45420bb
17851cf
20767ca
9619f8d
66fa69c
b8908ea
135f2ad
34a5687
6da8199
123f77e
54e74d1
04d3530
4bbf587
f849bc7
0c30e48
c4c952e
8645976
987c916
b775684
2e04e60
9b20ff5
0c14033
c7106dc
1640085
2846faf
5a645c0
6bac000
6f1c73f
a890337
0a9071c
9d8d40b
84c3491
a429206
5826ad9
cf7571b
4bc9787
18eed60
f715b55
6a765bf
af3fe50
eb7b5e1
f7dfcf4
a42a960
d019830
29d145f
248149c
a3da51e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,11 @@ We provide a number of common statistical functions: | |
:meth:`~Rolling.cov`, Unbiased covariance (binary) | ||
:meth:`~Rolling.corr`, Correlation (binary) | ||
|
||
.. _stats.rolling_apply: | ||
|
||
Rolling Apply | ||
~~~~~~~~~~~~~ | ||
|
||
The :meth:`~Rolling.apply` function takes an extra ``func`` argument and performs | ||
generic rolling computations. The ``func`` argument should be a single function | ||
that produces a single value from an ndarray input. Suppose we wanted to | ||
|
@@ -334,6 +339,20 @@ compute the mean absolute deviation on a rolling basis: | |
@savefig rolling_apply_ex.png | ||
s.rolling(window=60).apply(mad, raw=True).plot(style='k') | ||
|
||
Additionally, :meth:`~Rolling.apply` can leverage `Numba <https://numba.pydata.org/>`__ | ||
if installed as an optional dependency as the execution engine of the apply aggregation using the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you break this into 2 sentences, its hard to grok |
||
``engine='numba'`` and ``engine_kwargs`` arguments (``raw`` must also be set to ``True``). | ||
Numba will be applied in potentially two routines: | ||
|
||
1. If ``func`` is a standard Python function, the engine will JIT the passed function. ``func`` | ||
can also be a pre-JIT function in which case the engine will not JIT the function again. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is pre-JIT a term? I would say if its just a JITTED function its ok; can you add a numba refernce to what a JIT function is |
||
2. The engine will JIT the for loop where the apply function is applied to each window. | ||
|
||
The ``engine_kwargs`` argument is a dictionary of keyword arguments that will be passed into the | ||
`numba.jit decorator <https://numba.pydata.org/numba-doc/latest/reference/jit-compilation.html#numba.jit>`__. | ||
These keyword arguments will be applied to *both* the passed function (if a standard Python function) | ||
and the apply for loop. Currently only ``nogil``, ``nopython``, and ``parallel`` are supported. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. show the defaults for these kwargs |
||
|
||
.. _stats.rolling_window: | ||
|
||
Rolling windows | ||
|
Uh oh!
There was an error while loading. Please reload this page.