Skip to content

Commit

Permalink
Parametrize asv; temp. if-cond to test against master
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jun 28, 2018
1 parent 094139b commit 36b03a1
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions asv_bench/benchmarks/frame_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,10 @@ def time_frame_nunique(self):
class Duplicated(object):

goal_time = 0.2
params = (['first', 'last'], [True, False])
param_names = ['keep', 'return_inverse']

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

def time_frame_duplicated(self):
self.df.duplicated()

def time_frame_duplicated_wide(self):
self.df2.duplicated()

def time_frame_duplicated_wide_inverse(self):
# will take fastpath for no duplicates
self.df2.duplicated(return_inverse=True)

def time_frame_duplicated_mixed(self):
self.df3.duplicated()

def time_frame_duplicated_mixed_inverse(self):
self.df3.duplicated(return_inverse=True)

def time_frame_duplicated_mixed_inverse_last(self):
self.df3.duplicated(return_inverse=True, keep='last')
def time_frame_duplicated(self, keep, return_inverse):
if return_inverse:
self.df.duplicated(keep=keep, return_inverse=return_inverse)
else:
self.df.duplicated(keep=keep)

def time_frame_duplicated_wide(self, keep, return_inverse):
if return_inverse:
self.df2.duplicated(keep=keep, return_inverse=return_inverse)
else:
self.df2.duplicated(keep=keep)

def time_frame_duplicated_mixed(self, keep, return_inverse):
if return_inverse:
self.df3.duplicated(keep=keep, return_inverse=return_inverse)
else:
self.df3.duplicated(keep=keep)


class XS(object):
Expand Down

0 comments on commit 36b03a1

Please sign in to comment.