Skip to content

Commit 1c00ed1

Browse files
committed
ASV: more for str.cat [ci skip]
1 parent a5fe9cf commit 1c00ed1

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

asv_bench/benchmarks/strings.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import warnings
22

33
import numpy as np
4-
from pandas import Series
4+
from pandas import Series, DataFrame
55
import pandas.util.testing as tm
66

77

@@ -12,9 +12,6 @@ class Methods(object):
1212
def setup(self):
1313
self.s = Series(tm.makeStringIndex(10**5))
1414

15-
def time_cat(self):
16-
self.s.str.cat(sep=',')
17-
1815
def time_center(self):
1916
self.s.str.center(100)
2017

@@ -87,6 +84,23 @@ def time_repeat(self, repeats):
8784
self.s.str.repeat(self.repeat)
8885

8986

87+
class Cat(object):
88+
89+
goal_time = 0.2
90+
params = ([None, 5], [None, ','], [None, '-'])
91+
param_names = ['others', 'sep', 'na_rep']
92+
93+
def setup(self, others):
94+
N = 10**5
95+
self.s = Series(tm.makeStringIndex(N))
96+
self.others = (DataFrame({i: tm.makeStringIndex(N)
97+
for i in range(others)})
98+
if others is not None else None)
99+
100+
def time_cat(self, sep, na_rep):
101+
self.s.str.cat(self.others, sep=sep, na_rep=na_rep)
102+
103+
90104
class Contains(object):
91105

92106
goal_time = 0.2

0 commit comments

Comments
 (0)