Skip to content

Commit b9dc689

Browse files
committed
TST: GH26055 added whatsnew entry and renamed result and expected variables
1 parent a63c141 commit b9dc689

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

doc/source/whatsnew/v0.25.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ Groupby/Resample/Rolling
388388
- Ensured that result group order is correct when grouping on an ordered ``Categorical`` and specifying ``observed=True`` (:issue:`25871`, :issue:`25167`)
389389
- Bug in :meth:`pandas.core.window.Rolling.min` and :meth:`pandas.core.window.Rolling.max` that caused a memory leak (:issue:`25893`)
390390
- Bug in :func:`idxmax` and :func:`idxmin` on :meth:`DataFrame.groupby` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`)
391+
- Bug in :meth:`pandas.core.window._Rolling_and_Expanding.count` that did not include axis parameter in constructor call (:issue:`13503`)
391392

392393
Reshaping
393394
^^^^^^^^^

pandas/tests/test_window.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def test_iter_raises(self, klass):
648648
with pytest.raises(NotImplementedError):
649649
iter(obj.rolling(2))
650650

651-
def test_rolling_axis(self, axis_frame):
651+
def test_rolling_axis_sum(self, axis_frame):
652652
# see gh-23372.
653653
df = DataFrame(np.ones((10, 20)))
654654
axis = df._get_axis_number(axis_frame)
@@ -667,17 +667,21 @@ def test_rolling_axis(self, axis_frame):
667667
result = df.rolling(3, axis=axis_frame).sum()
668668
tm.assert_frame_equal(result, expected)
669669

670-
def test_count_axis(self):
670+
def test_rolling_axis_count(self):
671671
# see gh-26055
672672
df = DataFrame({'x': range(3), 'y': range(3)})
673-
df_row = DataFrame({'x': [1.0, 2.0, 2.0], 'y': [1.0, 2.0, 2.0]})
674673

675-
# not specifiying axis and making axis=rows should be the same result
676-
tm.assert_frame_equal(df.rolling(2).count(), df_row)
677-
tm.assert_frame_equal(df.rolling(2, axis='rows').count(), df_row)
674+
result = df.rolling(2).count()
675+
expected = DataFrame({'x': [1.0, 2.0, 2.0], 'y': [1.0, 2.0, 2.0]})
676+
tm.assert_frame_equal(result, expected)
677+
678+
# not specifiying axis and making axis=rows are expected to yeild the same result
679+
result = df.rolling(2, axis='rows').count()
680+
tm.assert_frame_equal(result, expected)
678681

679-
df_col = DataFrame({'x': [1.0, 1.0, 1.0], 'y': [2.0, 2.0, 2.0]})
680-
tm.assert_frame_equal(df.rolling(2, axis='columns').count(), df_col)
682+
result = df.rolling(2, axis='columns').count()
683+
expected = DataFrame({'x': [1.0, 1.0, 1.0], 'y': [2.0, 2.0, 2.0]})
684+
tm.assert_frame_equal(result, expected)
681685

682686

683687
class TestExpanding(Base):

0 commit comments

Comments
 (0)