-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: rolling.count with axis=1 #26055
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 7 commits
da47224 c64c76a 90c6915 4906502 c6e1232 41ae7fe 12065b6 80c8648 0f94d87 1c0f475 b0eae9e 0317be0 852ed4a 0777c54 6c99ab3 5b87937 25d6cb2 73208dc 308077f 1265757 a23c176 42c10af fff256d 3ba5d35 9b2b960 b8a6cae 34e3018 36d1c4e 499d910 2786a8c d040376 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 |
|---|---|---|
| | @@ -384,6 +384,7 @@ Groupby/Resample/Rolling | |
| - Ensured that result group order is correct when grouping on an ordered ``Categorical`` and specifying ``observed=True`` (:issue:`25871`, :issue:`25167`) | ||
| - Bug in :meth:`pandas.core.window.Rolling.min` and :meth:`pandas.core.window.Rolling.max` that caused a memory leak (:issue:`25893`) | ||
| - Bug in :func:`idxmax` and :func:`idxmin` on :meth:`DataFrame.groupby` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) | ||
| - Bug in :meth:`pandas.core.window._Rolling_and_Expanding.count` that did not include axis parameter in constructor call (:issue:`13503`) | ||
| ||
| | ||
| Reshaping | ||
| ^^^^^^^^^ | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -648,7 +648,7 @@ def test_iter_raises(self, klass): | |
| with pytest.raises(NotImplementedError): | ||
| iter(obj.rolling(2)) | ||
| | ||
| def test_rolling_axis(self, axis_frame): | ||
| def test_rolling_axis_sum(self, axis_frame): | ||
| # see gh-23372. | ||
| df = DataFrame(np.ones((10, 20))) | ||
| axis = df._get_axis_number(axis_frame) | ||
| | @@ -667,6 +667,23 @@ def test_rolling_axis(self, axis_frame): | |
| result = df.rolling(3, axis=axis_frame).sum() | ||
| tm.assert_frame_equal(result, expected) | ||
| | ||
| def test_rolling_axis_count(self): | ||
| ||
| # see gh-26055 | ||
| df = DataFrame({'x': range(3), 'y': range(3)}) | ||
| | ||
| result = df.rolling(2).count() | ||
| expected = DataFrame({'x': [1.0, 2.0, 2.0], 'y': [1.0, 2.0, 2.0]}) | ||
| tm.assert_frame_equal(result, expected) | ||
| | ||
| # not specifiying axis and making axis=rows | ||
| # are expected to yield the same result | ||
| result = df.rolling(2, axis='rows').count() | ||
| tm.assert_frame_equal(result, expected) | ||
| | ||
| result = df.rolling(2, axis='columns').count() | ||
| expected = DataFrame({'x': [1.0, 1.0, 1.0], 'y': [2.0, 2.0, 2.0]}) | ||
| tm.assert_frame_equal(result, expected) | ||
| | ||
| | ||
| class TestExpanding(Base): | ||
| | ||
| | ||
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.
looks like this was picked up somehow, pls remove