File: binary_ops.py

package info (click to toggle)
pandas 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 12,480 kB
  • sloc: python: 57,610; ansic: 3,960; makefile: 77; sh: 8
file content (26 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from vbench.benchmark import Benchmark
from datetime import datetime

common_setup = """from pandas_vb_common import *
"""

#----------------------------------------------------------------------
# data alignment

setup = common_setup + """n = 1000000
# indices = Index([rands(10) for _ in xrange(n)])
def sample(values, k):
    sampler = np.random.permutation(len(values))
    return values.take(sampler[:k])
sz = 500000
rng = np.arange(0, 10000000000000, 10000000)
stamps = np.datetime64(datetime.now()).view('i8') + rng
idx1 = np.sort(sample(stamps, sz))
idx2 = np.sort(sample(stamps, sz))
ts1 = Series(np.random.randn(sz), idx1)
ts2 = Series(np.random.randn(sz), idx2)
"""
stmt = "ts1 + ts2"
series_align_int64_index = Benchmark(stmt, setup,
                                     start_date=datetime(2010, 6, 1),
                                     logy=True)