11
11
12
12
import numpy as np
13
13
from numpy import random
14
- from numpy .random import randn
15
14
16
15
import pandas .plotting as plotting
17
16
@@ -35,8 +34,8 @@ def _skip_if_mpl_14_or_dev_boxplot():
35
34
class TestDataFramePlots (TestPlotBase ):
36
35
37
36
@pytest .mark .slow
38
- def test_boxplot_legacy (self ):
39
- df = DataFrame (randn (6 , 4 ),
37
+ def test_boxplot_legacy1 (self ):
38
+ df = DataFrame (np . random . randn (6 , 4 ),
40
39
index = list (string .ascii_letters [:6 ]),
41
40
columns = ['one' , 'two' , 'three' , 'four' ])
42
41
df ['indic' ] = ['foo' , 'bar' ] * 3
@@ -60,6 +59,8 @@ def test_boxplot_legacy(self):
60
59
with tm .assert_produces_warning (UserWarning ):
61
60
_check_plot_works (df .boxplot , by = 'indic' , notch = 1 )
62
61
62
+ @pytest .mark .slow
63
+ def test_boxplot_legacy2 (self ):
63
64
df = DataFrame (np .random .rand (10 , 2 ), columns = ['Col1' , 'Col2' ])
64
65
df ['X' ] = Series (['A' , 'A' , 'A' , 'A' , 'A' , 'B' , 'B' , 'B' , 'B' , 'B' ])
65
66
df ['Y' ] = Series (['A' ] * 10 )
@@ -103,7 +104,7 @@ def test_boxplot_return_type_legacy(self):
103
104
# API change in https://github.com/pandas-dev/pandas/pull/7096
104
105
import matplotlib as mpl # noqa
105
106
106
- df = DataFrame (randn (6 , 4 ),
107
+ df = DataFrame (np . random . randn (6 , 4 ),
107
108
index = list (string .ascii_letters [:6 ]),
108
109
columns = ['one' , 'two' , 'three' , 'four' ])
109
110
with pytest .raises (ValueError ):
@@ -176,18 +177,20 @@ def test_fontsize(self):
176
177
class TestDataFrameGroupByPlots (TestPlotBase ):
177
178
178
179
@pytest .mark .slow
179
- def test_boxplot_legacy (self ):
180
+ def test_boxplot_legacy1 (self ):
180
181
grouped = self .hist_df .groupby (by = 'gender' )
181
182
with tm .assert_produces_warning (UserWarning ):
182
183
axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
183
184
self ._check_axes_shape (list (axes .values ), axes_num = 2 , layout = (1 , 2 ))
184
185
axes = _check_plot_works (grouped .boxplot , subplots = False ,
185
186
return_type = 'axes' )
186
187
self ._check_axes_shape (axes , axes_num = 1 , layout = (1 , 1 ))
188
+
189
+ @pytest .mark .slow
190
+ def test_boxplot_legacy2 (self ):
187
191
tuples = lzip (string .ascii_letters [:10 ], range (10 ))
188
192
df = DataFrame (np .random .rand (10 , 3 ),
189
193
index = MultiIndex .from_tuples (tuples ))
190
-
191
194
grouped = df .groupby (level = 1 )
192
195
with tm .assert_produces_warning (UserWarning ):
193
196
axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
@@ -197,6 +200,11 @@ def test_boxplot_legacy(self):
197
200
return_type = 'axes' )
198
201
self ._check_axes_shape (axes , axes_num = 1 , layout = (1 , 1 ))
199
202
203
+ @pytest .mark .slow
204
+ def test_boxplot_legacy3 (self ):
205
+ tuples = lzip (string .ascii_letters [:10 ], range (10 ))
206
+ df = DataFrame (np .random .rand (10 , 3 ),
207
+ index = MultiIndex .from_tuples (tuples ))
200
208
grouped = df .unstack (level = 1 ).groupby (level = 0 , axis = 1 )
201
209
with tm .assert_produces_warning (UserWarning ):
202
210
axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
0 commit comments