1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
from vbench.benchmark import Benchmark
common_setup = """from pandas_vb_common import *
"""
#----------------------------------------------------------------------
# DataFrame.index / columns property lookup time
setup = common_setup + """
df = DataFrame(np.random.randn(10, 6))
cur_index = df.index
"""
stmt = "foo = df.index"
getattr_dataframe_index = Benchmark(stmt, setup,
name="getattr_dataframe_index")
stmt = "df.index = cur_index"
setattr_dataframe_index = Benchmark(stmt, setup,
name="setattr_dataframe_index")
|