-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/API: SeriesGroupBy reduction with numeric_only=True #41342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG/API: SeriesGroupBy reduction with numeric_only=True #41342
Conversation
if you can rebase this one |
haven't looked yet |
Rebased+green |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rebase and a couple of comments
For DataFrameGroupBy we want it to be True (for backwards-compat). | ||
""" | ||
# GH#41291 | ||
if numeric_only is lib.no_default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we deprecating the dataframe groupby behavior here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this is just a way of having the effective default be different for SeriesGroupBy vs DataFrameGroupBy
|
||
def get_result(): | ||
if method == "attr": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a super complicated test. can you try to split in followons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -906,6 +906,7 @@ Groupby/resample/rolling | |||
- Bug in :meth:`DataFrameGroupBy.__getitem__` with non-unique columns incorrectly returning a malformed :class:`SeriesGroupBy` instead of :class:`DataFrameGroupBy` (:issue:`41427`) | |||
- Bug in :meth:`DataFrameGroupBy.transform` with non-unique columns incorrectly raising ``AttributeError`` (:issue:`41427`) | |||
- Bug in :meth:`Resampler.apply` with non-unique columns incorrectly dropping duplicated columns (:issue:`41445`) | |||
- Bug in :meth:`SeriesGroupBy` aggregations incorrectly returning empty :class:`Series` instead of raising ``TypeError`` on aggregations that are invalid for its dtype (:issue:`41342`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you give an example here that a user would understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated + green
@@ -91,7 +91,10 @@ def test_cython_agg_nothing_to_agg(): | |||
frame = DataFrame({"a": np.random.randint(0, 5, 50), "b": ["foo", "bar"] * 25}) | |||
msg = "No numeric types to aggregate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be moved to the relevant section below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@jreback i think comments have been addressed; this is a blocker for fixing the analogous DataFrameGroupBy behavior |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. can merge on green.
…as into ref-numeric_only-sgb-2
Thanks @jbrockmendel |
This addresses the SeriesGroupBy (easier) half of #41291:
numeric_only=True
, change the default to False for SeriesGroupBy, leaving DataFrameGroupBy unaffected.