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 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
import numpy as np
from pandas import DataFrame
try:
from pandas.util import cache_readonly
except ImportError:
from pandas.util.decorators import cache_readonly
from .pandas_vb_common import setup # noqa
class DataFrameAttributes(object):
goal_time = 0.2
def setup(self):
self.df = DataFrame(np.random.randn(10, 6))
self.cur_index = self.df.index
def time_get_index(self):
self.foo = self.df.index
def time_set_index(self):
self.df.index = self.cur_index
class CacheReadonly(object):
goal_time = 0.2
def setup(self):
class Foo:
@cache_readonly
def prop(self):
return 5
self.obj = Foo()
def time_cache_readonly(self):
self.obj.prop
|