-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Min_weight for Rolling #12750
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
ENH: Min_weight for Rolling #12750
Conversation
is this in concert with |
While you could use them together, most cases are going to be an either / or. If it's just either / or, we could implement within |
Furthermore does the order of application of give this some tests, if its too complicated / not worth it, ok w/o supporting both simultaneously |
I think it's fine to have both - it will put a
My thought exactly |
579af97
to
3146b2f
Compare
@@ -1373,6 +1386,19 @@ def _check_func(minp, window): | |||
return _check_func | |||
|
|||
|
|||
def _min_weight_mask(rolling, min_weight): | |||
data = rolling.obj |
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 add a comment explaining what this is doing/why
|
Yes will do - this was WIP. Thanks for the comments |
result = rolling.mean() | ||
|
||
# check that all points between 25 and 90 are NaN | ||
self.assertTrue(result.iloc[24:89].isnull().all()) |
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.
construct the actual result
3146b2f
to
5f9801c
Compare
can you rebase / update |
5f9801c
to
0ca3efc
Compare
Current coverage is 84.65% (diff: 100%)@@ master #12750 diff @@
==========================================
Files 144 144
Lines 51025 51038 +13
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43191 43205 +14
+ Misses 7834 7833 -1
Partials 0 0
|
@@ -5175,30 +5175,34 @@ def _add_series_or_dataframe_operations(cls): | |||
from pandas.core import window as rwindow | |||
|
|||
@Appender(rwindow.rolling.__doc__) | |||
def rolling(self, window, min_periods=None, freq=None, center=False, |
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.
add to the doc-string min_weight
with a versionadded tag (I don't remember exactly where these are defined)
I've been remiss about the final fixes here. Will need a couple of weeks on other commitments but I will get to this |
can you rebase / update? |
if you can update |
Yes, apologies, this is another I'll attempt over / after Thanksgiving. Appreciate the patience! |
1d2a591
to
4c40a10
Compare
4c40a10
to
3c42153
Compare
looks like you rebased, great. needs some docs (computation.rst), whatsnew (you can do a sub-section or just put a ref to the docs) & doc-string examples. |
status? |
can you update |
Yes, thanks for your patience. I'll wrap most of these up over the next month |
@MaximilianR can you rebase / update |
Forgive the extreme delay for this + a couple others. I need a few more weeks on other stuff, and then I'll give a push to finishing these up. |
pls rebase / update. |
love the idea, but needs rebase and updating. |
Initial implementation for #11167.
Needs some additional tests - for dataframes, other axis values etc, but want to get this out there and get feedback.
Note that the implemenation is different than that for
min_periods
. This uses a single function to mask all rolling calculations.min_periods
is implemented separately for each function. I imagine the latter is a bit faster, although also more complicated.min_weight
in addition tomin_periods
for ewma #11167git diff upstream/master | flake8 --diff