Skip to content

Commit d90e164

Browse files
committed
Parametrize na_fraction
1 parent 5d44e66 commit d90e164

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

asv_bench/benchmarks/strings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,19 @@ def time_repeat(self, repeats):
8787
class Cat(object):
8888

8989
goal_time = 0.2
90-
params = ([None, 5], [None, ','], [None, '-'])
91-
param_names = ['others', 'sep', 'na_rep']
90+
params = ([None, 5], [None, ','], [None, '-'], [0.0, 1e-4, 0.1])
91+
param_names = ['others', 'sep', 'na_rep', 'na_frac']
9292

93-
def setup(self, others, sep, na_rep):
93+
def setup(self, others, sep, na_rep, na_frac):
9494
N = int(5e5)
95-
mask_gen = lambda: np.random.choice([True, False], N, p=[0.9, 0.1])
95+
mask_gen = lambda: np.random.choice([True, False], N,
96+
p=[1 - na_frac, na_frac])
9697
self.s = Series(tm.makeStringIndex(N)).where(mask_gen())
9798
self.others = (DataFrame({i: tm.makeStringIndex(N).where(mask_gen())
9899
for i in range(others)})
99100
if others is not None else None)
100101

101-
def time_cat(self, others, sep, na_rep):
102+
def time_cat(self, others, sep, na_rep, na_frac):
102103
self.s.str.cat(self.others, sep=sep, na_rep=na_rep)
103104

104105

0 commit comments

Comments
 (0)