Skip to content

Commit f04891a

Browse files
update docstring and add comments for code
1 parent f5113fc commit f04891a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pandas/core/internals/managers.py

+3
Original file line numberDiff line numberDiff line change
@@ -1967,11 +1967,14 @@ def items_overlap_with_suffix(left, lsuffix, right, rsuffix):
19671967
if len(to_rename) == 0:
19681968
return left, right
19691969
else:
1970+
# if column name is string, raise error if suffix is a combination of
1971+
# empty string and None, or two Nones
19701972
if isinstance(to_rename[0], str):
19711973
if not lsuffix and not rsuffix:
19721974
raise ValueError('columns overlap but no suffix specified: '
19731975
'{rename}'.format(rename=to_rename))
19741976
else:
1977+
# if not, only suffix with (None, None) will raise error
19751978
if lsuffix is None and rsuffix is None:
19761979
raise ValueError('columns overlap but no suffix specified: '
19771980
'{rename}'.format(rename=to_rename))

pandas/core/reshape/merge.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ def merge_ordered(left, right, on=None,
165165
`left` and `right` respectively. Pass a value of `None` instead
166166
of a string to indicate that the column name from `left` or
167167
`right` should be left as-is, with no suffix. At least one of the
168-
values must not be None.
168+
values must not be None. A combination of `''` and `None` is will
169+
raise error for columns which type is string
169170
how : {'left', 'right', 'outer', 'inner'}, default 'outer'
170171
* left: use only keys from left frame (SQL: left outer join)
171172
* right: use only keys from right frame (SQL: right outer join)

0 commit comments

Comments
 (0)