Skip to content

Commit f6ce37a

Browse files
Clean-up constructor benchmarks
1 parent 6e85a2b commit f6ce37a

File tree

2 files changed

+92
-1682
lines changed

2 files changed

+92
-1682
lines changed

asv_bench/benchmarks/ctors.py

+12-34
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,30 @@
11
from .pandas_vb_common import *
22

33

4-
class frame_constructor_ndarray(object):
4+
class Constructors(object):
55
goal_time = 0.2
66

77
def setup(self):
88
self.arr = np.random.randn(100, 100)
9+
self.arr_str = np.array(['foo', 'bar', 'baz'], dtype=object)
910

10-
def time_frame_constructor_ndarray(self):
11-
DataFrame(self.arr)
12-
13-
14-
class ctor_index_array_string(object):
15-
goal_time = 0.2
16-
17-
def setup(self):
18-
self.data = np.array(['foo', 'bar', 'baz'], dtype=object)
19-
20-
def time_ctor_index_array_string(self):
21-
Index(self.data)
22-
23-
24-
class series_constructor_ndarray(object):
25-
goal_time = 0.2
26-
27-
def setup(self):
2811
self.data = np.random.randn(100)
2912
self.index = Index(np.arange(100))
3013

31-
def time_series_constructor_ndarray(self):
32-
Series(self.data, index=self.index)
14+
self.s = Series(([Timestamp('20110101'), Timestamp('20120101'),
15+
Timestamp('20130101')] * 1000))
3316

17+
def time_frame_from_ndarray(self):
18+
DataFrame(self.arr)
3419

35-
class dtindex_from_series_ctor(object):
36-
goal_time = 0.2
20+
def time_series_from_ndarray(self):
21+
pd.Series(self.data, index=self.index)
3722

38-
def setup(self):
39-
self.s = Series(([Timestamp('20110101'), Timestamp('20120101'), Timestamp('20130101')] * 1000))
23+
def time_index_from_array_string(self):
24+
Index(self.arr_str)
4025

41-
def time_dtindex_from_series_ctor(self):
26+
def time_dtindex_from_series(self):
4227
DatetimeIndex(self.s)
4328

44-
45-
class index_from_series_ctor(object):
46-
goal_time = 0.2
47-
48-
def setup(self):
49-
self.s = Series(([Timestamp('20110101'), Timestamp('20120101'), Timestamp('20130101')] * 1000))
50-
51-
def time_index_from_series_ctor(self):
29+
def time_dtindex_from_series2(self):
5230
Index(self.s)

0 commit comments

Comments
 (0)