From e7195380e1b0eba3e3f680d3ab0482005bb0ef8c Mon Sep 17 00:00:00 2001 From: Yong Kai Yi Date: Fri, 16 Oct 2020 09:16:22 +0800 Subject: [PATCH] TST: test for expanding window with min_periods GH25857 (#37131) --- pandas/tests/window/test_expanding.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandas/tests/window/test_expanding.py b/pandas/tests/window/test_expanding.py index b06a506281047..3dc1974685226 100644 --- a/pandas/tests/window/test_expanding.py +++ b/pandas/tests/window/test_expanding.py @@ -137,6 +137,14 @@ def test_expanding_count_default_min_periods_with_null_values(constructor): tm.assert_equal(result, expected) +@pytest.mark.parametrize("constructor", [Series, DataFrame]) +def test_expanding_count_with_min_periods_exceeding_series_length(constructor): + # GH 25857 + result = constructor(range(5)).expanding(min_periods=6).count() + expected = constructor([np.nan, np.nan, np.nan, np.nan, np.nan]) + tm.assert_equal(result, expected) + + @pytest.mark.parametrize( "df,expected,min_periods", [