-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: reindex_like after shape comparison #15496
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
in assert_frame_equal, if check_like, the former code reindex_like before shape comparison. for example: if left.shape=(2,2), right.shpae(2.0), after reindex_like, left.shape(2,0),right.shape(2,0),then the shape comparison will get wrong result.
@jojomdt Thanks for the contribution. We also have tests for our testing infrastructure, so can you add a test for this? (in pandas/tests/test_testing.py) I suppose your change was the original intended behaviour (@jreback? that is what it is used for in our tests), i.e. to support comparing frames with different row order. But if so, we should clarify that in the docstring of |
this is probably more correct in that it gives a nicer error if you have s shape mismatch (it works now but will give a value comparison error) what case did this come up in? (ideally add this to the tests of the testers as joris indicates) |
Codecov Report
@@ Coverage Diff @@
## master #15496 +/- ##
==========================================
- Coverage 90.36% 90.36% -0.01%
==========================================
Files 135 135
Lines 49519 49519
==========================================
- Hits 44747 44746 -1
- Misses 4772 4773 +1
Continue to review full report at Codecov.
|
add test_equal_with_different_row_order, change shape error message test
change it to ''If true, ignore the order of rows & columns''
add a test for dataframe with different row order to be equal, simplify shape comparison |
change \\[right\\]: \\(4, 1\\) to \\[right\\]: \\(3, 1\\)
in assert_frame_equal, if check_like, the former code reindex_like before shape comparison. for example: if left.shape=(2,2), right.shpae=(2.0), after reindex_like, left.shape=(2,0),right.shape=(2,0),then the shape comparison will not find out that the two dataframes are different. For that, the assert_frame_equal will not raise assertion errors. But in fact it should raise. Author: jojomdt <[email protected]> Closes pandas-dev#15496 from jojomdt/master and squashes the following commits: 7b3437b [jojomdt] fix test_frame_equal_message error 0340b5c [jojomdt] change check_like description c03e0af [jojomdt] add test for TestAssertFrameEqual 470dbaa [jojomdt] combine row and column shape comparison ce7bd74 [jojomdt] reindex_like after shape comparison
thanks @jojomdt |
in assert_frame_equal, if check_like, the former code reindex_like before shape comparison. for example: if left.shape=(2,2), right.shpae=(2.0), after reindex_like, left.shape=(2,0),right.shape=(2,0),then the shape comparison will not find out that the two dataframes are different. For that, the assert_frame_equal will not raise assertion errors. But in fact it should raise. Author: jojomdt <[email protected]> Closes pandas-dev#15496 from jojomdt/master and squashes the following commits: 7b3437b [jojomdt] fix test_frame_equal_message error 0340b5c [jojomdt] change check_like description c03e0af [jojomdt] add test for TestAssertFrameEqual 470dbaa [jojomdt] combine row and column shape comparison ce7bd74 [jojomdt] reindex_like after shape comparison
in assert_frame_equal, if check_like, the former code reindex_like before shape comparison.
for example:
if left.shape=(2,2), right.shpae=(2.0), after reindex_like, left.shape=(2,0),right.shape=(2,0),then the shape comparison will not find out that the two dataframes are different. For that, the assert_frame_equal will not raise assertion errors. But in fact it should raise.
@jreback