@@ -21,6 +21,42 @@ def time_rolling(self, constructor, window, dtype, method):
21
21
getattr (self .roll , method )()
22
22
23
23
24
+ class ExpandingMethods (object ):
25
+
26
+ sample_time = 0.2
27
+ params = (['DataFrame' , 'Series' ],
28
+ ['int' , 'float' ],
29
+ ['median' , 'mean' , 'max' , 'min' , 'std' , 'count' , 'skew' , 'kurt' ,
30
+ 'sum' ])
31
+ param_names = ['contructor' , 'window' , 'dtype' , 'method' ]
32
+
33
+ def setup (self , constructor , dtype , method ):
34
+ N = 10 ** 5
35
+ arr = (100 * np .random .random (N )).astype (dtype )
36
+ self .expanding = getattr (pd , constructor )(arr ).expanding ()
37
+
38
+ def time_expanding (self , constructor , dtype , method ):
39
+ getattr (self .expanding , method )()
40
+
41
+
42
+ class EWMMethods (object ):
43
+
44
+ sample_time = 0.2
45
+ params = (['DataFrame' , 'Series' ],
46
+ [10 , 1000 ],
47
+ ['int' , 'float' ],
48
+ ['mean' , 'std' ])
49
+ param_names = ['contructor' , 'window' , 'dtype' , 'method' ]
50
+
51
+ def setup (self , constructor , window , dtype , method ):
52
+ N = 10 ** 5
53
+ arr = (100 * np .random .random (N )).astype (dtype )
54
+ self .ewm = getattr (pd , constructor )(arr ).ewm (halflife = window )
55
+
56
+ def time_ewm (self , constructor , window , dtype , method ):
57
+ getattr (self .ewm , method )()
58
+
59
+
24
60
class VariableWindowMethods (Methods ):
25
61
sample_time = 0.2
26
62
params = (['DataFrame' , 'Series' ],
0 commit comments