Skip to content

Commit a1618db

Browse files
committed
documented DataFrame.merge behaviour for suffix=(False, False)
1 parent 55d176d commit a1618db

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pandas/core/frame.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184
the order of the join keys depends on the join type (how keyword).
185185
suffixes : 2-length sequence (tuple, list, ...)
186186
Suffix to apply to overlapping column names in the left and right
187-
side, respectively.
187+
side, respectively. If (False, False), overlapping
188+
column names raise an error.
188189
copy : boolean, default True
189190
If False, avoid copy if possible.
190191
indicator : boolean or string, default False
@@ -254,6 +255,23 @@
254255
3 foo 5 foo 8
255256
4 bar 2 bar 6
256257
5 baz 3 baz 7
258+
259+
>>> A.merge(B, left_on='lkey', right_on='rkey', how='outer',
260+
suffixes=('_left', '_right'))
261+
lkey value_left rkey value_right
262+
0 foo 1 foo 5
263+
1 foo 1 foo 8
264+
2 foo 5 foo 5
265+
3 foo 5 foo 8
266+
4 bar 2 bar 6
267+
5 baz 3 baz 7
268+
269+
>>> A.merge(B, left_on='lkey', right_on='rkey', how='outer',
270+
suffixes=(False, False))
271+
Traceback (most recent call last):
272+
...
273+
ValueError: columns overlap but no suffix specified:
274+
Index(['value'], dtype='object')
257275
"""
258276

259277
# -----------------------------------------------------------------------

0 commit comments

Comments
 (0)