|
13 | 13 | date_range = DateRange
|
14 | 14 |
|
15 | 15 | ts = Series(np.random.randn(N), index=rng)
|
| 16 | +""" |
16 | 17 |
|
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)) |
20 | 24 | """
|
21 | 25 |
|
22 | 26 | replace_fillna = Benchmark('ts.fillna(0., inplace=True)', common_setup,
|
| 27 | + name='replace_fillna', |
23 | 28 | start_date=datetime(2012, 4, 4))
|
24 | 29 | replace_replacena = Benchmark('ts.replace(np.nan, 0., inplace=True)',
|
25 | 30 | common_setup,
|
| 31 | + name='replace_replacena', |
26 | 32 | 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