Skip to content

Commit e9e978e

Browse files
Chang Shewesm
Chang She
authored andcommitted
BUG: raise exception when merging with insufficient info #1307
1 parent 0badc55 commit e9e978e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/tools/merge.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ def _validate_specification(self):
366366
else:
367367
# use the common columns
368368
common_cols = self.left.columns.intersection(self.right.columns)
369+
if len(common_cols) == 0:
370+
raise Exception('No common columns to perform merge on')
369371
self.left_on = self.right_on = common_cols
370372
elif self.on is not None:
371373
if self.left_on is not None or self.right_on is not None:

0 commit comments

Comments
 (0)