Skip to content

Commit ebf777a

Browse files
committed
test fixup
1 parent d434816 commit ebf777a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/tests/groupby/test_groupby.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,9 +915,13 @@ def test_omit_nuisance_agg(df, agg_function, numeric_only):
915915
else:
916916
with tm.assert_produces_warning(warn, match="Dropping invalid columns"):
917917
result = getattr(grouped, agg_function)(numeric_only=numeric_only)
918-
if numeric_only is lib.no_default or not numeric_only:
918+
if (
919+
(numeric_only is lib.no_default or not numeric_only)
920+
# These methods drop non-numeric columns even when numeric_only is False
921+
and agg_function not in ("mean", "prod", "median")
922+
):
919923
columns = ["A", "B", "C", "D"]
920-
elif numeric_only:
924+
else:
921925
columns = ["A", "C", "D"]
922926
expected = getattr(df.loc[:, columns].groupby("A"), agg_function)(
923927
numeric_only=numeric_only

0 commit comments

Comments
 (0)