Skip to content

Commit 671ff98

Browse files
horaceklaifeefladder
authored andcommitted
TST: GH34037 add test for type error when using parameter 'min_period' (pandas-dev#42940)
1 parent 6e811d7 commit 671ff98

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/groupby/test_groupby.py

+12
Original file line numberDiff line numberDiff line change
@@ -2407,3 +2407,15 @@ def test_datetime_categorical_multikey_groupby_indices():
24072407
("c", Timestamp("2018-03-01 00:00:00")): np.array([2]),
24082408
}
24092409
assert result == expected
2410+
2411+
2412+
def test_rolling_wrong_param_min_period():
2413+
# GH34037
2414+
name_l = ["Alice"] * 5 + ["Bob"] * 5
2415+
val_l = [np.nan, np.nan, 1, 2, 3] + [np.nan, 1, 2, 3, 4]
2416+
test_df = DataFrame([name_l, val_l]).T
2417+
test_df.columns = ["name", "val"]
2418+
2419+
result_error_msg = r"__init__\(\) got an unexpected keyword argument 'min_period'"
2420+
with pytest.raises(TypeError, match=result_error_msg):
2421+
test_df.groupby("name")["val"].rolling(window=2, min_period=1).sum()

0 commit comments

Comments
 (0)