1
1
import 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
3
4
4
- from .pandas_vb_common import setup # noqa
5
+ from .pandas_vb_common import setup # noqa
5
6
6
7
7
8
class SeriesConstructors (object ):
@@ -21,7 +22,6 @@ class SeriesConstructors(object):
21
22
22
23
def setup (self , data_fmt , with_index ):
23
24
N = 10 ** 4
24
- np .random .seed (1234 )
25
25
arr = np .random .randn (N )
26
26
self .data = data_fmt (arr )
27
27
self .index = np .arange (N ) if with_index else None
@@ -35,21 +35,32 @@ class SeriesDtypesConstructors(object):
35
35
goal_time = 0.2
36
36
37
37
def setup (self ):
38
- N = 10 ** 2
38
+ N = 10 ** 4
39
39
self .arr = np .random .randn (N , N )
40
40
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
-
45
41
self .s = Series ([Timestamp ('20110101' ), Timestamp ('20120101' ),
46
42
Timestamp ('20130101' )] * N * 10 )
47
43
48
44
def time_index_from_array_string (self ):
49
45
Index (self .arr_str )
50
46
47
+ def time_index_from_array_floats (self ):
48
+ Index (self .arr )
49
+
51
50
def time_dtindex_from_series (self ):
52
51
DatetimeIndex (self .s )
53
52
54
53
def time_dtindex_from_index_with_series (self ):
55
54
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