Skip to content

ENH: Improve error reporting for wrong merge cols #37547

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

Merged
merged 7 commits into from
Nov 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix raising condition
  • Loading branch information
phofl committed Oct 31, 2020
commit e865ae749e268507b0d499635a210f212fd2e98c
4 changes: 2 additions & 2 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ def _validate_specification(self):
raise MergeError(
'Can only pass argument "left_on" OR "left_index" not both.'
)
if not self.right_index or self.right_on is None:
if not self.right_index and self.right_on is None:
raise MergeError('Must pass "right_on" OR "right_index".')
n = len(self.left_on)
if self.right_index:
Expand All @@ -1249,7 +1249,7 @@ def _validate_specification(self):
raise MergeError(
'Can only pass argument "right_on" OR "right_index" not both.'
)
if not self.left_index or self.left_on is None:
if not self.left_index and self.left_on is None:
raise MergeError('Must pass "left_on" OR "left_index".')
n = len(self.right_on)
if self.left_index:
Expand Down