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

Use align_method in comp_method_FRAME #23132

Merged
merged 21 commits into from
Oct 23, 2018
Merged

Conversation

jbrockmendel
Copy link
Member

Redux to #22880 @jorisvandenbossche

Closes #20090

Summary:
DataFrame comparison operations broadcasting is inconsistent with arithmetic operations broadcasting. This PR fixes that.

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@@ -1934,6 +1934,9 @@ def _comp_method_FRAME(cls, func, special):

@Appender('Wrapper for comparison method {name}'.format(name=op_name))
def f(self, other):

other = _align_method_FRAME(self, other, axis=None)
Copy link
Member Author

Choose a reason for hiding this comment

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

This line does all the work of changing broadcasting behavior.

@jreback
Copy link
Contributor

jreback commented Oct 14, 2018

i think was ok with this before, needs a rebase, @jorisvandenbossche

@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Numeric Operations Arithmetic, Comparison, and Logical operations labels Oct 14, 2018
@codecov
Copy link

codecov bot commented Oct 14, 2018

Codecov Report

Merging #23132 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23132      +/-   ##
==========================================
+ Coverage   92.19%   92.22%   +0.03%     
==========================================
  Files         169      169              
  Lines       50956    50877      -79     
==========================================
- Hits        46978    46922      -56     
+ Misses       3978     3955      -23
Flag Coverage Δ
#multiple 90.64% <100%> (+0.03%) ⬆️
#single 42.33% <100%> (+0.05%) ⬆️
Impacted Files Coverage Δ
pandas/core/internals/managers.py 95.75% <ø> (-0.03%) ⬇️
pandas/core/internals/blocks.py 94.08% <ø> (+1.17%) ⬆️
pandas/core/ops.py 94.64% <100%> (ø) ⬆️
pandas/core/frame.py 97.11% <100%> (-0.01%) ⬇️
pandas/core/reshape/merge.py 94.01% <0%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e06c84...d2c8ca2. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Oct 14, 2018
@jbrockmendel
Copy link
Member Author

@jorisvandenbossche focusing here instead of PeriodArray for a bit. Can you recap your concerns?

@jbrockmendel
Copy link
Member Author

@jorisvandenbossche gentle ping. You're the gate-keeper for this and #23113.

@jreback
Copy link
Contributor

jreback commented Oct 18, 2018

would also merge master here

@jreback
Copy link
Contributor

jreback commented Oct 23, 2018

lgtm. merging shorty.


- operating against a 2-dimensional ``np.ndarray`` with either 1 row or 1 column will now broadcast the same way a ``np.ndarray`` would (:issue:`23000`).
- a list or tuple with length matching the number of rows in the :class:`DataFrame` will now raise ``ValueError`` instead of operating column-by-column (:issue:`22880`.
- a list or tuple with length matching the number of columns in the :class:`DataFrame` will now operate row-by-row instead of raising ``ValueError`` (:issue:`22880`).
Copy link
Contributor

Choose a reason for hiding this comment

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

does this case match numpy?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

arr = np.arange(6).reshape(3, 2)
>>> arr == [0, 1]
array([[ True,  True],
       [False, False],
       [False, False]])

Copy link
Contributor

Choose a reason for hiding this comment

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

ok then

@jreback jreback merged commit 1735f42 into pandas-dev:master Oct 23, 2018
@jreback
Copy link
Contributor

jreback commented Oct 23, 2018

thanks!

@jorisvandenbossche
Copy link
Member

@jreback I know I have not been responsive here (I have been rather busy with thoroughly looking at all the EA related stuff), but I would appreciate if you didn't merge this without me looking at it (I was the original reason this got reverted). There are other ways to reach out to me.

@jreback
Copy link
Contributor

jreback commented Oct 23, 2018

this was blocking other things; you need to divide your time then

@jorisvandenbossche
Copy link
Member

Then at least mention it is blocking other PRs, then I can try to prioritize it

@jreback
Copy link
Contributor

jreback commented Oct 23, 2018

you were pinged multiple times if u really want to block then put a review request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixed-dtype dataframe comparison with array raises incorrectly
4 participants