-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: RollingGroupBy.quantile
ignores interpolation
keyword argument
#29567
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
352445c
8a5054d
ed7aa3f
48cb4e5
fde54ce
61c5142
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,6 @@ def test_rolling(self): | |
r = g.rolling(window=4) | ||
|
||
for f in ["sum", "mean", "min", "max", "count", "kurt", "skew"]: | ||
|
||
result = getattr(r, f)() | ||
expected = g.apply(lambda x: getattr(x.rolling(4), f)()) | ||
tm.assert_frame_equal(result, expected) | ||
|
@@ -69,9 +68,10 @@ def test_rolling(self): | |
expected = g.apply(lambda x: getattr(x.rolling(4), f)(ddof=1)) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
result = r.quantile(0.5) | ||
expected = g.apply(lambda x: x.rolling(4).quantile(0.5)) | ||
tm.assert_frame_equal(result, expected) | ||
for f in ["linear", "lower", "higher", "midpoint", "nearest"]: | ||
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. Either here or in a follow up could you parametrize this test with these values rather than the loop within? 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 u make this a separate test and parmetrize 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. Yes, I think I can handle that here - working on it now. 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. I wrote a new test called
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. Oops, @WillAyd's suggestion to rebuild the Cython extensions was correct. The tests are now passing; I'm going to push my changes shortly. 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. The change is pushed - let me know if that's different from what you had in mind! |
||
result = r.quantile(0.4, interpolation=f) | ||
expected = g.apply(lambda x: x.rolling(4).quantile(0.4, interpolation=f)) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
def test_rolling_corr_cov(self): | ||
g = self.frame.groupby("A") | ||
|
@@ -141,9 +141,10 @@ def test_expanding(self): | |
expected = g.apply(lambda x: getattr(x.expanding(), f)(ddof=0)) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
result = r.quantile(0.5) | ||
expected = g.apply(lambda x: x.expanding().quantile(0.5)) | ||
tm.assert_frame_equal(result, expected) | ||
for f in ["linear", "lower", "higher", "midpoint", "nearest"]: | ||
result = r.quantile(0.4, interpolation=f) | ||
expected = g.apply(lambda x: x.expanding().quantile(0.4, interpolation=f)) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
def test_expanding_corr_cov(self): | ||
g = self.frame.groupby("A") | ||
|
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 don’t think this will render, can u see how we reference rolling in other notes
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, I'll find another example in the notes and imitate it.
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 changed the reference to
DataFrameGroupBy.rolling().quantile()
, similarly to the reference toDataFrameGroupBy.rolling().apply()
here: https://pandas.pydata.org/pandas-docs/version/0.23.4/whatsnew.html#groupby-resample-rolling. Hopefully that will work better?