-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Agg functions for df not respecting numeric only with level #40683
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
Conversation
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -720,7 +720,7 @@ Other | |||
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`) | |||
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`) | |||
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`) | |||
|
|||
- Bug in aggregation functions for :class:`DataFrame` not respecting ``numeric_only`` argument when ``level`` keyword was given (:issue:`40660`) |
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.
level is really doing a groupby, I think it make senses to move the note there.
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.
At least, I've always thought about level as being an alias for groupby(level=...).
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.
yeah, generally try to avoid the 'Other' section.
nb. we have a PR somewhere deprecating level=
to these
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.
Thx, was not sure if groupby was the correct place.
This bug is actually a good argument for the deprecation and removal...
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -720,7 +720,7 @@ Other | |||
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`) | |||
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`) | |||
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`) | |||
|
|||
- Bug in aggregation functions for :class:`DataFrame` not respecting ``numeric_only`` argument when ``level`` keyword was given (:issue:`40660`) |
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.
yeah, generally try to avoid the 'Other' section.
nb. we have a PR somewhere deprecating level=
to these
pandas/tests/groupby/test_groupby.py
Outdated
@@ -2190,3 +2190,18 @@ def test_groupby_mean_duplicate_index(rand_series_with_duplicate_datetimeindex): | |||
result = dups.groupby(level=0).mean() | |||
expected = dups.groupby(dups.index).mean() | |||
tm.assert_series_equal(result, expected) | |||
|
|||
|
|||
@pytest.mark.parametrize("meth", ["max", "min", "sum", "mean", "median"]) |
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.
hmm can you put these with similar tests, maybe in test_reductions?
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.
Moved
thanks @phofl |
stumbled accross this one