|
61 | 61 | bm_df_getitem2 = Benchmark(statement, setup,
|
62 | 62 | name='datamatrix_getitem_scalar')
|
63 | 63 |
|
64 |
| -setup = common_setup + """ |
65 |
| -try: |
66 |
| - klass = DataMatrix |
67 |
| -except: |
68 |
| - klass = DataFrame |
69 | 64 |
|
| 65 | +#---------------------------------------------------------------------- |
| 66 | +# ix get scalar |
| 67 | + |
| 68 | +setup = common_setup + """ |
70 | 69 | index = [tm.rands(10) for _ in xrange(1000)]
|
71 | 70 | columns = [tm.rands(10) for _ in xrange(30)]
|
72 |
| -df = klass(np.random.rand(1000, 30), index=index, |
| 71 | +df = DataFrame(np.random.randn(1000, 30), index=index, |
73 | 72 | columns=columns)
|
74 | 73 | idx = index[100]
|
75 | 74 | col = columns[10]
|
76 | 75 | """
|
77 |
| -statement = "df.get_value(idx, col)" |
78 |
| -bm_df_getitem3 = Benchmark(statement, setup, |
79 |
| - name='dataframe_get_value', |
80 |
| - start_date=datetime(2011, 11, 12)) |
| 76 | + |
| 77 | +indexing_frame_get_value_ix = Benchmark("df.ix[idx,col]", setup, |
| 78 | + name='indexing_frame_get_value_ix', |
| 79 | + start_date=datetime(2011, 11, 12)) |
| 80 | + |
| 81 | +indexing_frame_get_value = Benchmark("df.get_value(idx,col)", setup, |
| 82 | + name='indexing_frame_get_value', |
| 83 | + start_date=datetime(2011, 11, 12)) |
81 | 84 |
|
82 | 85 | #----------------------------------------------------------------------
|
83 | 86 | # Boolean DataFrame row selection
|
|
0 commit comments