Skip to content

Commit

Permalink
TST: asv benchmarks for Series constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
toobaz committed Dec 13, 2017
1 parent b8e0dab commit 95e3524
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions asv_bench/benchmarks/ctors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ def setup(self):

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

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):
Series(self.data, index=self.index)

def time_index_from_array_string(self):
Index(self.arr_str)

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

def time_dtindex_from_index_with_series(self):
Index(self.s)

def time_series_from_ndarray(self):
Series(self.data, index=self.index)

def time_series_from_list(self):
Series(self.list_data, index=self.index)

def time_series_from_dict(self):
Series(self.dict_data)

def time_series_from_dict_and_index(self):
Series(self.dict_data, index=self.index)

def time_series_from_list_of_lists(self):
Series(self.list_of_lists, index=self.index)

def time_series_from_almost_list_of_lists(self):
Series(self.almost_list_of_lists, index=self.index)

0 comments on commit 95e3524

Please sign in to comment.