Skip to content

Commit c3064e6

Browse files
committed
BUG:Sanity check on merge parameters for correct exception pandas-dev#26824
1 parent 430f0fd commit c3064e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/reshape/merge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,13 +1089,19 @@ def _validate_specification(self):
10891089
raise ValueError('len(left_on) must equal the number '
10901090
'of levels in the index of "right"')
10911091
self.right_on = [None] * n
1092+
if not self.right_on:
1093+
raise ValueError('both left_on and right_on '
1094+
'should be passed')
10921095
elif self.right_on is not None:
10931096
n = len(self.right_on)
10941097
if self.left_index:
10951098
if len(self.right_on) != self.left.index.nlevels:
10961099
raise ValueError('len(right_on) must equal the number '
10971100
'of levels in the index of "left"')
10981101
self.left_on = [None] * n
1102+
if not self.left_on:
1103+
raise ValueError('both left_on and right_on '
1104+
'should be passed')
10991105
if len(self.right_on) != len(self.left_on):
11001106
raise ValueError("len(right_on) must equal len(left_on)")
11011107

0 commit comments

Comments
 (0)