14
14
15
15
16
16
@pytest .mark .parametrize ("agg_func" , ["any" , "all" ])
17
- @pytest .mark .parametrize ("skipna" , [True , False ])
18
17
@pytest .mark .parametrize (
19
18
"vals" ,
20
19
[
33
32
[np .nan , np .nan , np .nan ],
34
33
],
35
34
)
36
- def test_groupby_bool_aggs (agg_func , skipna , vals ):
35
+ def test_groupby_bool_aggs (skipna , agg_func , vals ):
37
36
df = DataFrame ({"key" : ["a" ] * 3 + ["b" ] * 3 , "val" : vals * 2 })
38
37
39
38
# Figure out expectation using Python builtin
@@ -43,9 +42,11 @@ def test_groupby_bool_aggs(agg_func, skipna, vals):
43
42
if skipna and all (isna (vals )) and agg_func == "any" :
44
43
exp = False
45
44
46
- exp_df = DataFrame ([exp ] * 2 , columns = ["val" ], index = Index (["a" , "b" ], name = "key" ))
45
+ expected = DataFrame (
46
+ [exp ] * 2 , columns = ["val" ], index = Index (["a" , "b" ], name = "key" )
47
+ )
47
48
result = getattr (df .groupby ("key" ), agg_func )(skipna = skipna )
48
- tm .assert_frame_equal (result , exp_df )
49
+ tm .assert_frame_equal (result , expected )
49
50
50
51
51
52
def test_any ():
@@ -63,7 +64,7 @@ def test_any():
63
64
64
65
@pytest .mark .parametrize ("bool_agg_func" , ["any" , "all" ])
65
66
def test_bool_aggs_dup_column_labels (bool_agg_func ):
66
- # 21668
67
+ # GH# 21668
67
68
df = DataFrame ([[True , True ]], columns = ["a" , "a" ])
68
69
grp_by = df .groupby ([0 ])
69
70
result = getattr (grp_by , bool_agg_func )()
@@ -73,7 +74,6 @@ def test_bool_aggs_dup_column_labels(bool_agg_func):
73
74
74
75
75
76
@pytest .mark .parametrize ("bool_agg_func" , ["any" , "all" ])
76
- @pytest .mark .parametrize ("skipna" , [True , False ])
77
77
@pytest .mark .parametrize (
78
78
"data" ,
79
79
[
@@ -141,7 +141,6 @@ def test_masked_mixed_types(dtype1, dtype2, exp_col1, exp_col2):
141
141
142
142
@pytest .mark .parametrize ("bool_agg_func" , ["any" , "all" ])
143
143
@pytest .mark .parametrize ("dtype" , ["Int64" , "Float64" , "boolean" ])
144
- @pytest .mark .parametrize ("skipna" , [True , False ])
145
144
def test_masked_bool_aggs_skipna (bool_agg_func , dtype , skipna , frame_or_series ):
146
145
# GH#40585
147
146
obj = frame_or_series ([pd .NA , 1 ], dtype = dtype )
0 commit comments