-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API: provide Rolling/Expanding/EWM objects for deferred rolling type calculations #10702 #11603
Conversation
Cc @jhamman who has been working on this for xray. |
pushing to 0.18.0, I think |
6f7de2f
to
4790a88
Compare
3352a93
to
ec5fd94
Compare
ok, this is ready, MUCH bigger rabbit hole that I thought. note on the doc-strings. Since now we have much more like a groupby interface, e.g.
Further I did the same with groupby doc-strings (again don't have the class distinction on the See Also). @jorisvandenbossche @shoyer @sinhrks @TomAugspurger @cpcloud |
f38b713
to
af0dc3c
Compare
One thing I've wanted to add but haven't, which may be easier using this framework, at least interface-wise, is rolling exponentially weighted functions -- i.e. add a window to all the ewm*() parameters. Obviously this would need to be implemented in Cython for performance, but perhaps interface-wise it would be simpler using the scheme proposed here. |
yep that would be quite straightforward to do interface wise but yes would need to be added to the cython functions (but not too hard there) |
any comments? |
|
||
Generally these methods all have the same interface. The binary operators | ||
(e.g. :func:`rolling_corr`) take two Series or DataFrames. Otherwise, they all | ||
The API for window statistics is quite similar to the way one works with ``Groupby`` objects, see the documentation :ref:`here <groupby>` |
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.
should be GroupBy
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.
done
so now aggregations are consistent with what you'd expect
|
For the last one (
In any case, this was allowed and is in the docstring. Eg the example I gave works for 0.16.2:
|
I think my code was correct at the beginning.
|
05d1385
to
2b81c88
Compare
might be still some small loose ends, but any further comments @jorisvandenbossche @shoyer |
API: provide Rolling/Expanding/EWM objects for deferred rolling type calculations #10702
bombs away! |
@jorisvandenbossche http://pandas-docs.github.io/pandas-docs-travis/computation.html#stats-moments does the |
👏 |
closes #10702
closes #9052
xref #4950, removal of depr
So this basically takes all of the
pd.rolling_*
,pd.expanding_*
,pd.ewma_*
routines and allows an object oriented interface, similar to groupby.Some benefits:
.agg/aggregate
function, similar to groupby, where you can do multiple aggregations at once__getitem__
accessing, e.g.df.rolling(....)['A','B'].sum()
for a nicer APIOther:
ToDO:
.agg
pd.expanding_*
,pd.rolling_*
,pd.ewma_*
interface as this is polluting the top-level namespace quite a bitdo rolling/expanding/ewma ops
and allow the various aggregation type of ops (similar to groupby)