Skip to content

Commit fb2b609

Browse files
committed
TST: GH26055 added test_count_axis to TestRolling
1 parent da47224 commit fb2b609

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/test_window.py

+12
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,18 @@ 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):
671+
# see gh-26055
672+
df = pd.DataFrame({'x':range(5), 'y':range(5)})
673+
674+
df_correct_row_count = pd.DataFrame({'x':[1.0, 2.0, 2.0, 2.0, 2.0], 'y': [1.0, 2.0, 2.0, 2.0, 2.0]})
675+
676+
assert_equal(df.rolling(2).count(), df_correct_row_count)
677+
assert_equal(df.rolling(2, axis='rows').count(), df_correct_row_count)
678+
679+
df_correct_column_count = pd.DataFrame({'x':[1.0, 1.0, 1.0, 1.0, 1.0], 'y': [2.0, 2.0, 2.0, 2.0, 2.0]})
680+
assert_equal(df.rolling(2, axis='columns').count(), df_correct_column_count)
681+
670682

671683
class TestExpanding(Base):
672684

0 commit comments

Comments
 (0)