-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: list of lists in Series.str.cat #21950
Labels
Milestone
Comments
To check for myself, and as a little "advert" for this proposal, I wanted to see what
|
gfyoung
added
Strings
String extension data type and string data
Deprecate
Functionality to remove in pandas
labels
Jul 18, 2018
4 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
.str.cat
-method is the only one in thestr
-accessor that takes another Series as an argument, and as such, is a bit of a special case (e.g. it had no index alignment until v0.23).It makes sense to support lists of objects which get concatenated sequentially, and list of lists have been supported since at least v0.17, see https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.Series.str.cat.html
When I wrote #20347, I tried very hard to keep signature backwards-compatible, and the example from the v0.17-22 docs working:
However, this added lots of complexity, and I think that this should be simplified, especially in light of @TomAugspurger's comment in #21894
My suggestion is to modify the allowed combinations (as of v0.23) as follows:
In other words, if the user wants sequential concatenation, there are many possibilities available, and list-of-lists does not have to be one of them, IMO. This would substantially simplify (post-deprecation) the code for
str.cat._get_series_list
, which is currently a bit complicated. https://github.com/pandas-dev/pandas/blob/v0.23.3/pandas/core/strings.py#L2089Finally, for completeness, the example from the v0.17-22 docs has been removed for v0.23, but there are two examples in https://pandas.pydata.org/pandas-docs/stable/text.html#concatenating-a-series-and-many-objects-into-a-series that would fall under the deprecation I'm suggesting.
The text was updated successfully, but these errors were encountered: