Skip to content

Commit 5a72c79

Browse files
committed
Added the suggested changes. Removed the redundant comments and tests from test_reductions.py
1 parent 6ef5696 commit 5a72c79

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ def _cython_agg_general(
17551755
**kwargs,
17561756
):
17571757
# Note: we never get here with how="ohlc" for DataFrameGroupBy;
1758-
# that goes through SeriesGroupBy
1758+
# that goes through SeriesGroupBy
17591759

17601760
if not is_bool(numeric_only):
17611761
raise ValueError("numeric_only accepts only Boolean values")

pandas/tests/groupby/test_reductions.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,13 +1522,10 @@ def test_groupby_std_datetimelike():
15221522
tm.assert_frame_equal(result, expected)
15231523

15241524
def test_mean_numeric_only_validates_bool():
1525-
"""
1526-
Test that numeric_only parameter only accepts boolean values.
1527-
See GH#62778
1528-
"""
1525+
# GH#62778
1526+
15291527
df = pd.DataFrame({"A": range(5), "B": range(5)})
15301528

1531-
# These test cases should raise a ValueError
15321529
msg = "numeric_only accepts only Boolean values"
15331530
with pytest.raises(ValueError, match=msg):
15341531
df.groupby(["A"]).mean(["B"])
@@ -1538,9 +1535,3 @@ def test_mean_numeric_only_validates_bool():
15381535

15391536
with pytest.raises(ValueError, match=msg):
15401537
df.groupby(["A"]).mean(numeric_only=1)
1541-
1542-
# These test cases should work absolutely fine
1543-
df.groupby(["A"]).mean()
1544-
df.groupby(["A"]).mean(numeric_only=True)
1545-
df.groupby(["A"]).mean(numeric_only=False)
1546-

0 commit comments

Comments
 (0)