-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
API: return_type argument in StringMethods.split() #9847
Comments
…ingMethods.split() return value
Fix: pandas-dev#9847, adding a "same" and "expand" param to the StringMethods.spit
if someone wants to tackle this in next day ok, otherwise can deprecate in 0.17.0 (its a simple deprecation so no big deal, can accept both) |
IMO it would be really stupid do not do it kwow (giving users one release extra to get used to the to be deprecated keyword). |
@jreback, @jorisvandenbossche I've worked on this, and issue a PR once the test has been passed. |
closed by #10085 |
Version 0.16.1 * tag 'v0.16.1': (222 commits) RLS: v0.16.1 final DOC: missed merge in v0.16.1 whatsnew DOC: add v0.17.0.txt whatsnew (not in index yet though) BUG: Series.fillna() raises if given a numerically convertible string DOC: add docstring for PeriodIndex.asfreq more fixups Index repr: allow unequal number of elements on one line Change Index repr to adjust to string length fixup for CategoricalIndex merge formatting MultiIndex ENH: repr now shows index name pandas-dev#6482 DOC: prepare for 0.16.1 release DOC: edits in v0.16.1 whatsnew DEPR: Deprecate str.split return_type pandas-dev#9847 fix the inconsistency between code and description ENH: support str translate for StringMethods ENH: support StringMethods index and rindex Release note [ci skip] TST: using - rather than difference in tools/plotting.py DOC: additional whatsnew ENH: support __radd__ operation on Index (GH10083) ...
xref #9667 Now we also have string methods available on the index, the possible options for
return_type
('series', 'frame') are a bit confusing I think: it will be confusing for users to get a Index back even if he/she suppliesreturn_type='series'
on a Index.str.split, or to get a series back withSeries.str.split(.., return_type='index')
?Possible ways to make this a better API:
An
expand
keyword (or another name), that indicates forFalse
: give same dimension back (so for series/index keep it a series/index), and forTrue
: expand series to dataframe.This would then be a duplicate for
return_type
of course. But thereturn_type
was only introduced in 0.15.1 (and forpartition
it is still in a PR), so if we want to change this: better now than later. Or has this ship sailed?easier solution of @jreback:
return_type='same'|'expand'
to satisfy this need? (and can be easily back-compat) -> so no need to change the name of the keyword, only the arguments.The text was updated successfully, but these errors were encountered: