@@ -324,8 +324,43 @@ def f(K=100):
324
324
df = DataFrame({ i:s for i in range(1028) })
325
325
"""
326
326
frame_apply_user_func = Benchmark ('df.apply(lambda x: np.corrcoef(x,s)[0,1])' , setup ,
327
+ name = 'frame_apply_user_func' ,
327
328
start_date = datetime (2012 ,1 ,1 ))
328
329
330
+ setup = common_setup + """
331
+ df = DataFrame(np.random.randn(1000,100))
332
+ """
333
+ frame_apply_lambda_mean = Benchmark ('df.apply(lambda x: x.sum())' , setup ,
334
+ name = 'frame_apply_lambda_mean' ,
335
+ start_date = datetime (2012 ,1 ,1 ))
336
+ setup = common_setup + """
337
+ df = DataFrame(np.random.randn(1000,100))
338
+ """
339
+ frame_apply_np_mean = Benchmark ('df.apply(np.mean)' , setup ,
340
+ name = 'frame_apply_np_mean' ,
341
+ start_date = datetime (2012 ,1 ,1 ))
342
+
343
+ setup = common_setup + """
344
+ df = DataFrame(np.random.randn(1000,100))
345
+ """
346
+ frame_apply_pass_thru = Benchmark ('df.apply(lambda x: x)' , setup ,
347
+ name = 'frame_apply_pass_thru' ,
348
+ start_date = datetime (2012 ,1 ,1 ))
349
+
350
+ setup = common_setup + """
351
+ df = DataFrame(np.random.randn(1000,100))
352
+ """
353
+ frame_apply_axis_1 = Benchmark ('df.apply(lambda x: x+1,axis=1)' , setup ,
354
+ name = 'frame_apply_axis_1' ,
355
+ start_date = datetime (2012 ,1 ,1 ))
356
+
357
+ setup = common_setup + """
358
+ df = DataFrame(np.random.randn(1000,3),columns=list('ABC'))
359
+ """
360
+ frame_apply_ref_by_name = Benchmark ('df.apply(lambda x: x["A"] + x["B"],axis=1)' , setup ,
361
+ name = 'frame_apply_ref_by_name' ,
362
+ start_date = datetime (2012 ,1 ,1 ))
363
+
329
364
#----------------------------------------------------------------------
330
365
# dtypes
331
366
0 commit comments