diff --git a/asv_bench/benchmarks/ctors.py b/asv_bench/benchmarks/ctors.py index b5694a3a21502..2c9c382e2db86 100644 --- a/asv_bench/benchmarks/ctors.py +++ b/asv_bench/benchmarks/ctors.py @@ -1,24 +1,28 @@ -from .pandas_vb_common import * +import numpy as np +from pandas import DataFrame, Series, Index, DatetimeIndex, Timestamp class Constructors(object): + goal_time = 0.2 def setup(self): - self.arr = np.random.randn(100, 100) + N = 10**2 + np.random.seed(1234) + self.arr = np.random.randn(N, N) self.arr_str = np.array(['foo', 'bar', 'baz'], dtype=object) - self.data = np.random.randn(100) - self.index = Index(np.arange(100)) + self.data = np.random.randn(N) + self.index = Index(np.arange(N)) - self.s = Series(([Timestamp('20110101'), Timestamp('20120101'), - Timestamp('20130101')] * 1000)) + self.s = Series([Timestamp('20110101'), Timestamp('20120101'), + Timestamp('20130101')] * N * 10) def time_frame_from_ndarray(self): DataFrame(self.arr) def time_series_from_ndarray(self): - pd.Series(self.data, index=self.index) + Series(self.data, index=self.index) def time_index_from_array_string(self): Index(self.arr_str) @@ -26,5 +30,5 @@ def time_index_from_array_string(self): def time_dtindex_from_series(self): DatetimeIndex(self.s) - def time_dtindex_from_series2(self): + def time_dtindex_from_index_with_series(self): Index(self.s)