-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: change default for sep in str.cat (in docstring) #23443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
5e2bd40
8f595e0
d361dce
af66b94
f39416e
ae638b9
712642b
29be975
0f32510
608f2d2
2d1bf05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2051,7 +2051,7 @@ def _get_series_list(self, others, ignore_index=False): | |
return ([Series(others, index=idx)], False) | ||
raise TypeError(err_msg) | ||
|
||
def cat(self, others=None, sep=None, na_rep=None, join=None): | ||
def cat(self, others=None, sep='', na_rep=None, join=None): | ||
""" | ||
Concatenate strings in the Series/Index with given separator. | ||
|
||
|
@@ -2074,9 +2074,10 @@ def cat(self, others=None, sep=None, na_rep=None, join=None): | |
|
||
If others is None, the method returns the concatenation of all | ||
strings in the calling Series/Index. | ||
sep : string or None, default None | ||
If None, concatenates without any separator. | ||
na_rep : string or None, default None | ||
sep : str, default '' | ||
The separator between the different elements/columns. By default | ||
the empty string `''` is used. | ||
na_rep : str or None, default None | ||
Representation that is inserted for all missing values: | ||
|
||
- If `na_rep` is None, and `others` is None, missing values in the | ||
|
@@ -2197,6 +2198,10 @@ def cat(self, others=None, sep=None, na_rep=None, join=None): | |
if isinstance(others, compat.string_types): | ||
raise ValueError("Did you mean to supply a `sep` keyword?") | ||
if sep is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think just adding the doc-string update is enough. we commondly accept none, then actuall do this check here. The reason is if you actually pass None your change will fail (pls add a test to check that) |
||
warnings.warn('Passing `sep=None` to .str.cat is deprecated and ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls remove this and just update as I suggested. |
||
'will be removed in a future version. Please use ' | ||
'`sep=''` to pass the default explicitly', | ||
FutureWarning, stacklevel=2) | ||
sep = '' | ||
|
||
if isinstance(self._orig, Index): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is likely some other check for
sep is None
in the codebase, this shouldn't pass, and as I said pls change back to the original modulo the doc-string.