-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
ENH: Raise useful error when iterating a Window #20996
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 4 commits
fe9e310 9fd89dc 4ac67f0 15224fe 4b44b05 1bcaa7f 6bd748d 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 |
|---|---|---|
| | @@ -46,6 +46,27 @@ def win_types_special(request): | |
| return request.param | ||
| | ||
| | ||
| # Issue 11704: Iteration over a Window | ||
| | ||
| @pytest.fixture | ||
| ||
| def series(): | ||
| return pd.Series([1, 2, 3, 4]) | ||
| | ||
| @pytest.fixture | ||
| def frame(): | ||
| return pd.DataFrame({'a': [1, 2, 3, 4], 'b': [10, 20, 30, 40]}) | ||
| | ||
| @pytest.mark.parametrize('which', [series(), frame()]) | ||
| def test_rolling_iterator(which): | ||
| ||
| with pytest.raises(NotImplementedError): | ||
| iter(which.rolling(2)) | ||
| | ||
| @pytest.mark.parametrize('which', [series(), frame()]) | ||
| def test_expanding_iterator(which): | ||
| ||
| with pytest.raises(NotImplementedError): | ||
| iter(which.expanding()) | ||
| | ||
| | ||
| class Base(object): | ||
| | ||
| _nan_locs = np.arange(20, 40) | ||
| | ||
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.
Use double backticks around literals like NotImplementedError. Could also simply by just saying "Rolling and Expanding types will now raise a ``NotImplementedError`` upon iteration (:issue:`11704`)"
You may be right on how that eventually gets implemented but I wouldn't mention it here because who knows what change it could be subject to