Skip to content

Commit 59f7a23

Browse files
committed
DOC/ERR: better error message on no common merge keys
- Let MergeError emit values keyword arguments. - Add DataFrame.join on 'See also' section of pandas.merge.
1 parent 238499a commit 59f7a23

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
--------
234234
merge_ordered
235235
merge_asof
236-
236+
DataFrame.join : For index-based merge operations
237237
"""
238238

239239
# -----------------------------------------------------------------------

pandas/core/reshape/merge.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,14 @@ def _validate_specification(self):
10281028
common_cols = self.left.columns.intersection(
10291029
self.right.columns)
10301030
if len(common_cols) == 0:
1031-
raise MergeError('No common columns to perform merge on')
1031+
raise MergeError('No common columns to perform merge on. '
1032+
'Merge options: right_on={ron}, '
1033+
'left_on={lon}, right_index={ridx}, '
1034+
'left_index={lidx}'
1035+
.format(ron=self.right_on,
1036+
lon=self.left_on,
1037+
ridx=self.right_index,
1038+
lidx=self.left_index))
10321039
if not common_cols.is_unique:
10331040
raise MergeError("Data columns not unique: {common!r}"
10341041
.format(common=common_cols))

0 commit comments

Comments
 (0)