Skip to content

Commit e72437c

Browse files
committed
TST: asv benchmarks for Series constructors
1 parent 760df40 commit e72437c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

asv_bench/benchmarks/ctors.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ def setup(self):
1515

1616
self.data = np.random.randn(N)
1717
self.index = Index(np.arange(N))
18+
self.list_data = list(self.data)
19+
self.dict_data = {l: v for l, v in zip(self.data, self.index)}
20+
self.list_of_lists = [[i, -i] for i in self.data]
21+
self.almost_list_of_lists = self.list_of_lists[:-1] + [None]
1822

1923
self.s = Series([Timestamp('20110101'), Timestamp('20120101'),
2024
Timestamp('20130101')] * N * 10)
2125

2226
def time_frame_from_ndarray(self):
2327
DataFrame(self.arr)
2428

25-
def time_series_from_ndarray(self):
26-
Series(self.data, index=self.index)
27-
2829
def time_index_from_array_string(self):
2930
Index(self.arr_str)
3031

@@ -33,3 +34,21 @@ def time_dtindex_from_series(self):
3334

3435
def time_dtindex_from_index_with_series(self):
3536
Index(self.s)
37+
38+
def time_series_from_ndarray(self):
39+
Series(self.data, index=self.index)
40+
41+
def time_series_from_list(self):
42+
Series(self.list_data, index=self.index)
43+
44+
def time_series_from_dict(self):
45+
Series(self.dict_data)
46+
47+
def time_series_from_dict_and_index(self):
48+
Series(self.dict_data, index=self.index)
49+
50+
def time_series_from_list_of_lists(self):
51+
Series(self.list_of_lists, index=self.index)
52+
53+
def time_series_from_almost_list_of_lists(self):
54+
Series(self.almost_list_of_lists, index=self.index)

0 commit comments

Comments
 (0)