Skip to content

Commit d379a27

Browse files
committed
BENCH: add vbench for issue 6697
1 parent b8132b9 commit d379a27

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

vb_suite/replace.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,24 @@
1313
date_range = DateRange
1414
1515
ts = Series(np.random.randn(N), index=rng)
16+
"""
1617

17-
def replace_slow(ser, old, new):
18-
lib.slow_replace(ser.values, old, new)
19-
return ser
18+
large_dict_setup = """from pandas_vb_common import *
19+
from pandas.compat import range
20+
n = 10 ** 6
21+
start_value = 10 ** 5
22+
to_rep = dict((i, start_value + i) for i in range(n))
23+
s = Series(np.random.randint(n, size=10 ** 3))
2024
"""
2125

2226
replace_fillna = Benchmark('ts.fillna(0., inplace=True)', common_setup,
27+
name='replace_fillna',
2328
start_date=datetime(2012, 4, 4))
2429
replace_replacena = Benchmark('ts.replace(np.nan, 0., inplace=True)',
2530
common_setup,
31+
name='replace_replacena',
2632
start_date=datetime(2012, 5, 15))
27-
28-
# replace_putmask = Benchmark('replace_slow(ts, np.nan, 0.)', common_setup,
29-
# start_date=datetime(2012, 5, 15))
33+
replace_large_dict = Benchmark('s.replace(to_rep, inplace=True)',
34+
large_dict_setup,
35+
name='replace_large_dict',
36+
start_date=datetime(2014, 4, 6))

0 commit comments

Comments
 (0)