Skip to content
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.all(bool_only=True) inconsistency with object dtype #37799

Merged
merged 5 commits into from
Nov 14, 2020

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Discussed on the dev call yesterday.

assert self.ndim == 2

new_blocks = []
for i, ref_loc in enumerate(self.mgr_locs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be done as a list comprehension

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but nbd

@jreback jreback added this to the 1.2 milestone Nov 13, 2020
@jreback jreback added API - Consistency Internal Consistency of API/Behavior Dtype Conversions Unexpected or buggy dtype conversions labels Nov 13, 2020

Consistency of DataFrame Reductions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:meth:`DataFrame.any` and :meth:`DataFrame.all` with ``bool_only=True`` now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add this PR number here, and is there an actual issue? ping on green.


*New behavior*:

.. code-block:: ipython
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make this an ipython-block

"""
assert self.ndim == 2

new_blocks = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth adding some unit tests for this (e.g. on a block that is empty, since column and multilple)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, was accidentally making a copy instead of a view!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, testing is good!

@jbrockmendel
Copy link
Member Author

ping


.. ipython:: python

In [5]: df.all(bool_only=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need the prompts (remove in followon / other PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so remove the "In [5]: "? do i also remove the "Out [5]: "?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep i python will generate appropriately

"""
assert self.ndim == 2

new_blocks = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, testing is good!

@jreback jreback merged commit ba85a64 into pandas-dev:master Nov 14, 2020
@jbrockmendel jbrockmendel deleted the bug-reduce-bool branch November 14, 2020 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants