11import numpy as np
2- from pandas import Series , Index , DatetimeIndex , Timestamp
2+ import pandas .util .testing as tm
3+ from pandas import Series , Index , DatetimeIndex , Timestamp , MultiIndex
34
4- from .pandas_vb_common import setup # noqa
5+ from .pandas_vb_common import setup # noqa
56
67
78class SeriesConstructors (object ):
@@ -21,7 +22,6 @@ class SeriesConstructors(object):
2122
2223 def setup (self , data_fmt , with_index ):
2324 N = 10 ** 4
24- np .random .seed (1234 )
2525 arr = np .random .randn (N )
2626 self .data = data_fmt (arr )
2727 self .index = np .arange (N ) if with_index else None
@@ -35,21 +35,32 @@ class SeriesDtypesConstructors(object):
3535 goal_time = 0.2
3636
3737 def setup (self ):
38- N = 10 ** 2
38+ N = 10 ** 4
3939 self .arr = np .random .randn (N , N )
4040 self .arr_str = np .array (['foo' , 'bar' , 'baz' ], dtype = object )
41-
42- self .data = np .random .randn (N )
43- self .index = Index (np .arange (N ))
44-
4541 self .s = Series ([Timestamp ('20110101' ), Timestamp ('20120101' ),
4642 Timestamp ('20130101' )] * N * 10 )
4743
4844 def time_index_from_array_string (self ):
4945 Index (self .arr_str )
5046
47+ def time_index_from_array_floats (self ):
48+ Index (self .arr )
49+
5150 def time_dtindex_from_series (self ):
5251 DatetimeIndex (self .s )
5352
5453 def time_dtindex_from_index_with_series (self ):
5554 Index (self .s )
55+
56+
57+ class MultiIndexConstructor (object ):
58+
59+ goal_time = 0.2
60+
61+ def setup (self ):
62+ N = 10 ** 4
63+ self .iterables = [tm .makeStringIndex (N ), range (20 )]
64+
65+ def time_multiindex_from_iterables (self ):
66+ MultiIndex .from_product (self .iterables )
0 commit comments