Skip to content

Conversation

@horaceklai
Copy link
Contributor

@horaceklai horaceklai commented Aug 8, 2021

assert result == expected


def test_rolling_min_period():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to mention in this function title that min_period is incorrect

test_df.columns = ["name", "val"]

# correct one
test_df.groupby("name")["val"].rolling(window=2, min_periods=1).sum()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to test this line

# GH34037
result_error_msg = r"__init__\(\) got an unexpected keyword argument 'min_period'"
with pytest.raises(TypeError, match=result_error_msg):
name_l = ["Alice"] * 5 + ["Bob"] * 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the setup code should ideally be before the pytest.raises call

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Window rolling, ewma, expanding labels Aug 8, 2021
@mroeschke mroeschke added this to the 1.4 milestone Aug 8, 2021
@mroeschke mroeschke merged commit bc16631 into pandas-dev:master Aug 17, 2021
@mroeschke
Copy link
Member

Thanks @horaceklai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing pandas testing functions or related to the test suite Window rolling, ewma, expanding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: "min_period" and "min_periods" problem in df.groupby().rolling

2 participants