1111
1212import numpy as np
1313from numpy import random
14- from numpy .random import randn
1514
1615import pandas .plotting as plotting
1716
@@ -35,8 +34,8 @@ def _skip_if_mpl_14_or_dev_boxplot():
3534class TestDataFramePlots (TestPlotBase ):
3635
3736 @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 ),
4039 index = list (string .ascii_letters [:6 ]),
4140 columns = ['one' , 'two' , 'three' , 'four' ])
4241 df ['indic' ] = ['foo' , 'bar' ] * 3
@@ -60,6 +59,8 @@ def test_boxplot_legacy(self):
6059 with tm .assert_produces_warning (UserWarning ):
6160 _check_plot_works (df .boxplot , by = 'indic' , notch = 1 )
6261
62+ @pytest .mark .slow
63+ def test_boxplot_legacy2 (self ):
6364 df = DataFrame (np .random .rand (10 , 2 ), columns = ['Col1' , 'Col2' ])
6465 df ['X' ] = Series (['A' , 'A' , 'A' , 'A' , 'A' , 'B' , 'B' , 'B' , 'B' , 'B' ])
6566 df ['Y' ] = Series (['A' ] * 10 )
@@ -103,7 +104,7 @@ def test_boxplot_return_type_legacy(self):
103104 # API change in https://github.com/pandas-dev/pandas/pull/7096
104105 import matplotlib as mpl # noqa
105106
106- df = DataFrame (randn (6 , 4 ),
107+ df = DataFrame (np . random . randn (6 , 4 ),
107108 index = list (string .ascii_letters [:6 ]),
108109 columns = ['one' , 'two' , 'three' , 'four' ])
109110 with pytest .raises (ValueError ):
@@ -176,18 +177,20 @@ def test_fontsize(self):
176177class TestDataFrameGroupByPlots (TestPlotBase ):
177178
178179 @pytest .mark .slow
179- def test_boxplot_legacy (self ):
180+ def test_boxplot_legacy1 (self ):
180181 grouped = self .hist_df .groupby (by = 'gender' )
181182 with tm .assert_produces_warning (UserWarning ):
182183 axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
183184 self ._check_axes_shape (list (axes .values ), axes_num = 2 , layout = (1 , 2 ))
184185 axes = _check_plot_works (grouped .boxplot , subplots = False ,
185186 return_type = 'axes' )
186187 self ._check_axes_shape (axes , axes_num = 1 , layout = (1 , 1 ))
188+
189+ @pytest .mark .slow
190+ def test_boxplot_legacy2 (self ):
187191 tuples = lzip (string .ascii_letters [:10 ], range (10 ))
188192 df = DataFrame (np .random .rand (10 , 3 ),
189193 index = MultiIndex .from_tuples (tuples ))
190-
191194 grouped = df .groupby (level = 1 )
192195 with tm .assert_produces_warning (UserWarning ):
193196 axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
@@ -197,6 +200,11 @@ def test_boxplot_legacy(self):
197200 return_type = 'axes' )
198201 self ._check_axes_shape (axes , axes_num = 1 , layout = (1 , 1 ))
199202
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 ))
200208 grouped = df .unstack (level = 1 ).groupby (level = 0 , axis = 1 )
201209 with tm .assert_produces_warning (UserWarning ):
202210 axes = _check_plot_works (grouped .boxplot , return_type = 'axes' )
0 commit comments