Skip to content

TST: Test pd.Grouper base floating point error (#25161) #26240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 2, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/tests/groupby/test_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ def test_grouper_getting_correct_binner(self):
def test_grouper_iter(self, df):
assert sorted(df.groupby('A').grouper) == ['bar', 'foo']

def test_grouper_base(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move to test pandas/tests/resample/test_timegrouper and also test in .resample (which is what this calls)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it

# GH25161
dt = pd.to_datetime(["2018-11-26 16:17:43.51",
"2018-11-26 16:17:44.51",
"2018-11-26 16:17:45.51"])
s = Series(np.arange(3), index=dt)
base = 17 + 43.51 / 60
g = s.groupby(pd.Grouper(freq="3min", base=base))
result = g.size()
expected = Series(3, index=[dt[0]])
assert_series_equal(result, expected)

def test_empty_groups(self, df):
# see gh-1048
with pytest.raises(ValueError, match="No group keys passed!"):
Expand Down