Skip to content

Commit f993901

Browse files
committed
TST: Create a new function for testing grouper base (pandas-dev#25161)
1 parent da71a45 commit f993901

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pandas/tests/groupby/test_grouping.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,6 @@ 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-
218206
def test_grouper_column_and_index(self):
219207
# GH 14327
220208

@@ -315,6 +303,18 @@ def test_grouper_getting_correct_binner(self):
315303
def test_grouper_iter(self, df):
316304
assert sorted(df.groupby('A').grouper) == ['bar', 'foo']
317305

306+
def test_grouper_base(self):
307+
# GH25161
308+
s = Series(np.arange(10),
309+
index=pd.date_range(
310+
"2018-11-26 16:17:43.51",
311+
periods=10, freq="1S"))
312+
base = t0.minute + (t0.second + t0.microsecond / 1e6) / 60
313+
g = s.groupby(pd.Grouper(freq="10min", base=base))
314+
result = g.size()
315+
expected = pd.Series(10, index=Index([t0]))
316+
assert_series_equal(result, expected)
317+
318318
def test_empty_groups(self, df):
319319
# see gh-1048
320320
with pytest.raises(ValueError, match="No group keys passed!"):

0 commit comments

Comments
 (0)