1
- from .pandas_vb_common import *
2
- try :
3
- from pandas import date_range
4
- except ImportError :
5
- def date_range (start = None , end = None , periods = None , freq = None ):
6
- return DatetimeIndex (start , end , periods = periods , offset = freq )
1
+ import numpy as np
2
+ from pandas import DataFrame , Series , DatetimeIndex , date_range
7
3
try :
8
4
from pandas .plotting import andrews_curves
9
5
except ImportError :
10
6
from pandas .tools .plotting import andrews_curves
7
+ import matplotlib
8
+ matplotlib .use ('Agg' )
9
+
10
+ from .pandas_vb_common import setup # noqa
11
11
12
12
13
13
class Plotting (object ):
14
+
14
15
goal_time = 0.2
15
16
16
17
def setup (self ):
17
- import matplotlib
18
- matplotlib .use ('Agg' )
19
18
self .s = Series (np .random .randn (1000000 ))
20
19
self .df = DataFrame ({'col' : self .s })
21
20
@@ -27,18 +26,17 @@ def time_frame_plot(self):
27
26
28
27
29
28
class TimeseriesPlotting (object ):
29
+
30
30
goal_time = 0.2
31
31
32
32
def setup (self ):
33
- import matplotlib
34
- matplotlib .use ('Agg' )
35
33
N = 2000
36
34
M = 5
37
35
idx = date_range ('1/1/1975' , periods = N )
38
36
self .df = DataFrame (np .random .randn (N , M ), index = idx )
39
37
40
- idx_irregular = pd . DatetimeIndex (np .concatenate ((idx .values [0 :10 ],
41
- idx .values [12 :])))
38
+ idx_irregular = DatetimeIndex (np .concatenate ((idx .values [0 :10 ],
39
+ idx .values [12 :])))
42
40
self .df2 = DataFrame (np .random .randn (len (idx_irregular ), M ),
43
41
index = idx_irregular )
44
42
@@ -53,16 +51,14 @@ def time_plot_irregular(self):
53
51
54
52
55
53
class Misc (object ):
54
+
56
55
goal_time = 0.6
57
56
58
57
def setup (self ):
59
- import matplotlib
60
- matplotlib .use ('Agg' )
61
- self .N = 500
62
- self .M = 10
63
- data_dict = {x : np .random .randn (self .N ) for x in range (self .M )}
64
- data_dict ["Name" ] = ["A" ] * self .N
65
- self .df = DataFrame (data_dict )
58
+ N = 500
59
+ M = 10
60
+ self .df = DataFrame (np .random .randn (N , M ))
61
+ self .df ['Name' ] = ["A" ] * N
66
62
67
63
def time_plot_andrews_curves (self ):
68
64
andrews_curves (self .df , "Name" )
0 commit comments