Skip to content

CLN: ASV ctors benchmark #18479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions asv_bench/benchmarks/ctors.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
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)

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)