Skip to content

Commit 36b03a1

Browse files
committed
Parametrize asv; temp. if-cond to test against master
1 parent 094139b commit 36b03a1

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

asv_bench/benchmarks/frame_methods.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,10 @@ def time_frame_nunique(self):
412412
class Duplicated(object):
413413

414414
goal_time = 0.2
415+
params = (['first', 'last'], [True, False])
416+
param_names = ['keep', 'return_inverse']
415417

416-
def setup(self):
418+
def setup(self, keep, return_inverse):
417419
n = (1 << 20)
418420
t = date_range('2015-01-01', freq='S', periods=(n // 64))
419421
xs = np.random.randn(n // 64).round(2)
@@ -428,24 +430,23 @@ def setup(self):
428430
df3.loc[:, 'F'] = Series('', index=df3.index).str.cat(df3.astype(str))
429431
self.df3 = df3
430432

431-
def time_frame_duplicated(self):
432-
self.df.duplicated()
433-
434-
def time_frame_duplicated_wide(self):
435-
self.df2.duplicated()
436-
437-
def time_frame_duplicated_wide_inverse(self):
438-
# will take fastpath for no duplicates
439-
self.df2.duplicated(return_inverse=True)
440-
441-
def time_frame_duplicated_mixed(self):
442-
self.df3.duplicated()
443-
444-
def time_frame_duplicated_mixed_inverse(self):
445-
self.df3.duplicated(return_inverse=True)
446-
447-
def time_frame_duplicated_mixed_inverse_last(self):
448-
self.df3.duplicated(return_inverse=True, keep='last')
433+
def time_frame_duplicated(self, keep, return_inverse):
434+
if return_inverse:
435+
self.df.duplicated(keep=keep, return_inverse=return_inverse)
436+
else:
437+
self.df.duplicated(keep=keep)
438+
439+
def time_frame_duplicated_wide(self, keep, return_inverse):
440+
if return_inverse:
441+
self.df2.duplicated(keep=keep, return_inverse=return_inverse)
442+
else:
443+
self.df2.duplicated(keep=keep)
444+
445+
def time_frame_duplicated_mixed(self, keep, return_inverse):
446+
if return_inverse:
447+
self.df3.duplicated(keep=keep, return_inverse=return_inverse)
448+
else:
449+
self.df3.duplicated(keep=keep)
449450

450451

451452
class XS(object):

0 commit comments

Comments
 (0)