Skip to content

Commit da71a45

Browse files
committed
TST: Test pd.Grouper base floating point error (pandas-dev#25161)
1 parent 3de7139 commit da71a45

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/groupby/test_grouping.py

+12
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,18 @@ def test_grouper_creation_bug(self):
203203
expected = s.groupby(level='one').sum()
204204
assert_series_equal(result, expected)
205205

206+
# GH25161
207+
s = Series(np.arange(10),
208+
index=pd.date_range(
209+
"2018-11-26 16:17:43.51",
210+
periods=10, freq="1S"))
211+
t0 = s.index[0]
212+
base = t0.minute + (t0.second + t0.microsecond / 1e6) / 60
213+
g = s.groupby(pd.Grouper(freq="10min", base=base))
214+
result = g.size()
215+
expected = pd.Series(10, index=Index([t0]))
216+
assert_series_equal(result, expected)
217+
206218
def test_grouper_column_and_index(self):
207219
# GH 14327
208220

0 commit comments

Comments
 (0)