-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: rolling with Int64 #43174
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
BUG: rolling with Int64 #43174
Changes from 1 commit
f84c520
bc4a45e
57b0ceb
77416cc
3594d79
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
import pytest | ||
|
||
from pandas import ( | ||
NA, | ||
DataFrame, | ||
Series, | ||
) | ||
|
@@ -76,6 +77,14 @@ def test_series_dtypes(method, data, expected_data, coerce_int, dtypes, min_peri | |
tm.assert_almost_equal(result, expected) | ||
|
||
|
||
def test_series_nullable_int(any_signed_int_ea_dtype): | ||
# GH 43016 | ||
s = Series([0, 1, NA], dtype=any_signed_int_ea_dtype) | ||
result = s.rolling(2).mean() | ||
expected = Series([np.nan, 0.5, np.nan]) | ||
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. shouldn't we actually replace and use pd.NA as the output? or is this too big of a change? 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. Ideally, but currently all rolling/expanding/ewm results always return 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. ok, do we have an issue about this? we should make this change in 1.4 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. 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. hmm no was speaking about supporting pd.NA specifically (i think rolling_apply is totally fine) if you can add one 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 modified that issue to generally support same input/output dtypes (which include ExtensionDtypes that support pd.NA) |
||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"method, expected_data, min_periods", | ||
[ | ||
|
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.
we should change ensure_float64 to just do this directly (eg put your change there) - need to check perf and that this doesn't break anything
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 do isinstance instead of hasattr?