-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: DataFrame reductions inconsistent with Series counterparts #37827
Conversation
#28948 is an incorrect ref (top of PR) |
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.
doc comments & there is an oncorrect ref to #28948
A 1.0 | ||
dtype: float64 | ||
|
||
*New 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.
needs to be an ipython block & remove the prompts
A True | ||
dtype: bool | ||
|
||
*New 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.
make an ipython block & remove the prompts
@@ -513,8 +516,14 @@ def make_a_block(nv, ref_loc): | |||
v = new_values[i] | |||
|
|||
# need a new block | |||
if m.any(): | |||
nv = f(m, v, i) | |||
if m.any() or m.size == 0: |
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 add a comment here on what is going on
# Double-check the Series behavior is to raise | ||
with pytest.raises(TypeError, match="does not implement reduction"): | ||
getattr(ser, method)() | ||
with pytest.raises(TypeError, match="does not implement reduction"): |
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.
blank line here
# Double-check the Series behavior | ||
with pytest.raises(TypeError, match="is not ordered for operation"): | ||
getattr(ser, method)() | ||
with pytest.raises(TypeError, match="is not ordered for operation"): |
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.
blank line
@@ -284,6 +284,58 @@ of columns could result in a larger :class:`Series` result. See (:issue:`37799`) | |||
In [6]: df[["B", "C"]].all(bool_only=True) | |||
|
|||
|
|||
Other :class:`DataFrame` reductions with ``numeric_only=None`` will also avoid | |||
this pathological behavior (:issue:`37827`): |
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 make sure to list all the issues you are closing the OP (3?)
doc/source/whatsnew/v1.2.0.rst
Outdated
|
||
*New behavior*: | ||
|
||
.. code-block:: ipython |
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.
needs to be an ipython block to render
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.
dangit, i thought i had copied from the previous reduction PR, was so proud of myself
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.
haha
doc/source/whatsnew/v1.2.0.rst
Outdated
|
||
*New behavior*: | ||
|
||
.. code-block:: ipython |
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.
same
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff