From 79d24ed1584bffca382c848ce5c715f6659d881c Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 24 Nov 2017 17:53:21 -0800 Subject: [PATCH 1/2] CLN: ASV ctors --- asv_bench/benchmarks/ctors.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/asv_bench/benchmarks/ctors.py b/asv_bench/benchmarks/ctors.py index b5694a3a21502..063a91a5bcf59 100644 --- a/asv_bench/benchmarks/ctors.py +++ b/asv_bench/benchmarks/ctors.py @@ -1,24 +1,27 @@ -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 +29,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) From 01c854e90a660b80227fa7929566a168eb680bf6 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 24 Nov 2017 17:56:20 -0800 Subject: [PATCH 2/2] flake 8 --- asv_bench/benchmarks/ctors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/asv_bench/benchmarks/ctors.py b/asv_bench/benchmarks/ctors.py index 063a91a5bcf59..2c9c382e2db86 100644 --- a/asv_bench/benchmarks/ctors.py +++ b/asv_bench/benchmarks/ctors.py @@ -1,6 +1,7 @@ import numpy as np from pandas import DataFrame, Series, Index, DatetimeIndex, Timestamp + class Constructors(object): goal_time = 0.2