-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG:Sanity check on merge parameters for correct exception #26824 #26855
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
c3064e6
BUG:Sanity check on merge parameters for correct exception #26824
harshit-py c862ec0
added tests
harshit-py 0df85f0
updated tests for better coverage
harshit-py dea59fa
requested changes on the test
harshit-py 53aee36
updated whatsnew v0250rst
harshit-py 6396947
requested changes
harshit-py 11b1894
further changes
harshit-py 7b4aa22
updated test
harshit-py bfb7984
Merge branch 'master' into merge_py_bug
harshit-py 1e2b276
BUG:Sanity check on merge parameters for correct exception #26824
harshit-py 0f88c32
added tests
harshit-py a9905bd
updated tests for better coverage
harshit-py a939d8e
requested changes on the test
harshit-py 83f8cda
updated whatsnew v0250rst
harshit-py 962882d
requested changes
harshit-py 139d696
further changes
harshit-py 4e6bd89
updated test
harshit-py a0680e0
Trying original patch
harshit-py 0a894a9
Revert "Trying original patch"
harshit-py 0cb8843
Trying original patch
harshit-py 4e45c75
Revert "Trying original patch"
harshit-py 500e374
Trying original patch
harshit-py 773dec2
Original patch
harshit-py 7770b1d
further changes
harshit-py efb0761
Merge remote-tracking branch 'upstream/master' into harshit-py-merge_…
TomAugspurger 6b7f5a2
re-revert
TomAugspurger b7c482e
Merge pull request #1 from TomAugspurger/harshit-py-merge_py_bug
harshit-py e4e486c
Merge branch 'master' into PR_TOOL_MERGE_PR_26855
jreback File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1763,3 +1763,20 @@ def test_merge_equal_cat_dtypes2(): | |
|
||
# Categorical is unordered, so don't check ordering. | ||
tm.assert_frame_equal(result, expected, check_categorical=False) | ||
|
||
|
||
@pytest.mark.parametrize('merge_type', ['left_on', 'right_on']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this near the test_validation test |
||
def test_missing_on_raises(merge_type): | ||
# GH26824 | ||
df1 = DataFrame({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. call these left & right |
||
'A': [1, 2, 3, 4, 5, 6], | ||
'B': ['P', 'Q', 'R', 'S', 'T', 'U'] | ||
}) | ||
df2 = DataFrame({ | ||
'A': [1, 2, 4, 5, 7, 8], | ||
'C': ['L', 'M', 'N', 'O', 'P', 'Q'] | ||
}) | ||
msg = 'both left_on and right_on should be passed' | ||
kwargs = {merge_type: 'A'} | ||
with pytest.raises(ValueError, match=msg): | ||
pd.merge(df1, df2, how='left', **kwargs) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we instead try to set
self.left_on = self.left_on or [None] * len( self.right_on)
and same for right_on
before these if clauses; that way don’t need to add additional checks
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.
Sure