From 98c721a0e44584a06c243c7c7ef5a8c98fd50f9e Mon Sep 17 00:00:00 2001 From: themogget Date: Thu, 15 Oct 2020 15:31:59 +0800 Subject: [PATCH] TST: test for expanding window with min_periods GH25857 --- 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", [