Skip to content

Commit

Permalink
PERF: bench for pandas-dev#10287
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Jun 22, 2015
1 parent 7d6fb51 commit b069253
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions vb_suite/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,32 @@
series_ix_slice = Benchmark("s.ix[:800000]", setup)
series_ix_list_like = Benchmark("s.ix[[800000]]", setup)
series_ix_array = Benchmark("s.ix[np.arange(10000)]", setup)


# multi-index slicing
setup = common_setup + """
idx=pd.IndexSlice
n=100000
mdt = pandas.DataFrame()
mdt['A'] = np.random.choice(range(10000,45000,1000), n)
mdt['B'] = np.random.choice(range(10,400), n)
mdt['C'] = np.random.choice(range(1,150), n)
mdt['D'] = np.random.choice(range(10000,45000), n)
mdt['x'] = np.random.choice(range(400), n)
mdt['y'] = np.random.choice(range(25), n)
test_A = 25000
test_B = 25
test_C = 40
test_D = 35000
eps_A = 5000
eps_B = 5
eps_C = 5
eps_D = 5000
mdt2 = mdt.set_index(['A','B','C','D']).sortlevel()
"""

multiindex_slicers = Benchmark('mdt2.loc[idx[test_A-eps_A:test_A+eps_A,test_B-eps_B:test_B+eps_B,test_C-eps_C:test_C+eps_C,test_D-eps_D:test_D+eps_D],:]', setup,
start_date=datetime(2015, 1, 1))

0 comments on commit b069253

Please sign in to comment.