Skip to content

Commit 7cf9eb3

Browse files
update docstring and add comments for code
1 parent 46eea65 commit 7cf9eb3

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
@@ -1959,11 +1959,14 @@ def items_overlap_with_suffix(left, lsuffix, right, rsuffix):
19591959
if len(to_rename) == 0:
19601960
return left, right
19611961
else:
1962+
# if column name is string, raise error if suffix is a combination of
1963+
# empty string and None, or two Nones
19621964
if isinstance(to_rename[0], str):
19631965
if not lsuffix and not rsuffix:
19641966
raise ValueError('columns overlap but no suffix specified: '
19651967
'{rename}'.format(rename=to_rename))
19661968
else:
1969+
# if not, only suffix with (None, None) will raise error
19671970
if lsuffix is None and rsuffix is None:
19681971
raise ValueError('columns overlap but no suffix specified: '
19691972
'{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)