Skip to content

Commit feaca40

Browse files
committed
TST add vbench for groupby nth
1 parent c444c73 commit feaca40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

vb_suite/groupby.py

+16
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,22 @@ def f(g):
269269
groupby_frame_apply = Benchmark("df.groupby(['key', 'key2']).apply(f)", setup,
270270
start_date=datetime(2011, 10, 1))
271271

272+
273+
#----------------------------------------------------------------------
274+
# DataFrame nth
275+
276+
setup = common_setup + """
277+
df = pd.DataFrame(np.random.randint(1, 100, (10000, 2)))
278+
"""
279+
280+
# Not really a fair test as behaviour has changed!
281+
groupby_frame_nth = Benchmark("df.groupby(0).nth(0)", setup,
282+
start_date=datetime(2014, 3, 1))
283+
284+
groupby_series_nth = Benchmark("df[1].groupby(df[0]).nth(0)", setup,
285+
start_date=datetime(2014, 3, 1))
286+
287+
272288
#----------------------------------------------------------------------
273289
# Sum booleans #2692
274290

0 commit comments

Comments
 (0)