@@ -34,10 +34,20 @@ def _check_legend_labels(ax, labels):
34
34
assert label == e
35
35
36
36
37
- def test_series_hist_bins (scalars_dfs ):
37
+ @pytest .mark .parametrize (
38
+ ("alias" ),
39
+ [
40
+ pytest .param (True ),
41
+ pytest .param (False ),
42
+ ],
43
+ )
44
+ def test_series_hist_bins (scalars_dfs , alias ):
38
45
scalars_df , scalars_pandas_df = scalars_dfs
39
46
bins = 5
40
- ax = scalars_df ["int64_col" ].plot .hist (bins = bins )
47
+ if alias :
48
+ ax = scalars_df ["int64_col" ].hist (bins = bins )
49
+ else :
50
+ ax = scalars_df ["int64_col" ].plot .hist (bins = bins )
41
51
pd_ax = scalars_pandas_df ["int64_col" ].plot .hist (bins = bins )
42
52
43
53
# Compares axis values and height between bigframes and pandas histograms.
@@ -49,11 +59,21 @@ def test_series_hist_bins(scalars_dfs):
49
59
assert ax .patches [i ]._height == pd_ax .patches [i ]._height
50
60
51
61
52
- def test_dataframes_hist_bins (scalars_dfs ):
62
+ @pytest .mark .parametrize (
63
+ ("alias" ),
64
+ [
65
+ pytest .param (True ),
66
+ pytest .param (False ),
67
+ ],
68
+ )
69
+ def test_dataframes_hist_bins (scalars_dfs , alias ):
53
70
scalars_df , scalars_pandas_df = scalars_dfs
54
71
bins = 7
55
72
columns = ["int64_col" , "int64_too" , "float64_col" ]
56
- ax = scalars_df [columns ].plot .hist (bins = bins )
73
+ if alias :
74
+ ax = scalars_df [columns ].hist (bins = bins )
75
+ else :
76
+ ax = scalars_df [columns ].plot .hist (bins = bins )
57
77
pd_ax = scalars_pandas_df [columns ].plot .hist (bins = bins )
58
78
59
79
# Compares axis values and height between bigframes and pandas histograms.
@@ -171,10 +191,25 @@ def test_hist_kwargs_ticks_props(scalars_dfs):
171
191
tm .assert_almost_equal (ylabels [i ].get_rotation (), pd_ylables [i ].get_rotation ())
172
192
173
193
174
- def test_line (scalars_dfs ):
194
+ @pytest .mark .parametrize (
195
+ ("col_names" , "alias" ),
196
+ [
197
+ pytest .param (
198
+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], True , id = "df_alias"
199
+ ),
200
+ pytest .param (
201
+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], False , id = "df"
202
+ ),
203
+ pytest .param (["int64_col" ], True , id = "series_alias" ),
204
+ pytest .param (["int64_col" ], False , id = "series" ),
205
+ ],
206
+ )
207
+ def test_line (scalars_dfs , col_names , alias ):
175
208
scalars_df , scalars_pandas_df = scalars_dfs
176
- col_names = ["int64_col" , "float64_col" , "int64_too" , "bool_col" ]
177
- ax = scalars_df [col_names ].plot .line ()
209
+ if alias :
210
+ ax = scalars_df [col_names ].line ()
211
+ else :
212
+ ax = scalars_df [col_names ].plot .line ()
178
213
pd_ax = scalars_pandas_df [col_names ].plot .line ()
179
214
tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
180
215
tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -183,10 +218,21 @@ def test_line(scalars_dfs):
183
218
tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
184
219
185
220
186
- def test_area (scalars_dfs ):
221
+ @pytest .mark .parametrize (
222
+ ("col_names" , "alias" ),
223
+ [
224
+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], True , id = "df_alias" ),
225
+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], False , id = "df" ),
226
+ pytest .param (["int64_col" ], True , id = "series_alias" ),
227
+ pytest .param (["int64_col" ], False , id = "series" ),
228
+ ],
229
+ )
230
+ def test_area (scalars_dfs , col_names , alias ):
187
231
scalars_df , scalars_pandas_df = scalars_dfs
188
- col_names = ["int64_col" , "float64_col" , "int64_too" ]
189
- ax = scalars_df [col_names ].plot .area (stacked = False )
232
+ if alias :
233
+ ax = scalars_df [col_names ].area (stacked = False )
234
+ else :
235
+ ax = scalars_df [col_names ].plot .area (stacked = False )
190
236
pd_ax = scalars_pandas_df [col_names ].plot .area (stacked = False )
191
237
tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
192
238
tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -195,10 +241,21 @@ def test_area(scalars_dfs):
195
241
tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
196
242
197
243
198
- def test_bar (scalars_dfs ):
244
+ @pytest .mark .parametrize (
245
+ ("col_names" , "alias" ),
246
+ [
247
+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], True , id = "df_alias" ),
248
+ pytest .param (["int64_col" , "float64_col" , "int64_too" ], False , id = "df" ),
249
+ pytest .param (["int64_col" ], True , id = "series_alias" ),
250
+ pytest .param (["int64_col" ], False , id = "series" ),
251
+ ],
252
+ )
253
+ def test_bar (scalars_dfs , col_names , alias ):
199
254
scalars_df , scalars_pandas_df = scalars_dfs
200
- col_names = ["int64_col" , "float64_col" , "int64_too" ]
201
- ax = scalars_df [col_names ].plot .bar ()
255
+ if alias :
256
+ ax = scalars_df [col_names ].bar ()
257
+ else :
258
+ ax = scalars_df [col_names ].plot .bar ()
202
259
pd_ax = scalars_pandas_df [col_names ].plot .bar ()
203
260
tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
204
261
tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
@@ -207,10 +264,23 @@ def test_bar(scalars_dfs):
207
264
tm .assert_almost_equal (line .get_data ()[1 ], pd_line .get_data ()[1 ])
208
265
209
266
210
- def test_scatter (scalars_dfs ):
267
+ @pytest .mark .parametrize (
268
+ ("col_names" , "alias" ),
269
+ [
270
+ pytest .param (
271
+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], True , id = "df_alias"
272
+ ),
273
+ pytest .param (
274
+ ["int64_col" , "float64_col" , "int64_too" , "bool_col" ], False , id = "df"
275
+ ),
276
+ ],
277
+ )
278
+ def test_scatter (scalars_dfs , col_names , alias ):
211
279
scalars_df , scalars_pandas_df = scalars_dfs
212
- col_names = ["int64_col" , "float64_col" , "int64_too" , "bool_col" ]
213
- ax = scalars_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
280
+ if alias :
281
+ ax = scalars_df [col_names ].scatter (x = "int64_col" , y = "float64_col" )
282
+ else :
283
+ ax = scalars_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
214
284
pd_ax = scalars_pandas_df [col_names ].plot .scatter (x = "int64_col" , y = "float64_col" )
215
285
tm .assert_almost_equal (ax .get_xticks (), pd_ax .get_xticks ())
216
286
tm .assert_almost_equal (ax .get_yticks (), pd_ax .get_yticks ())
0 commit comments