Description
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 supplies return_type='series'
on a Index.str.split, or to get a series back with Series.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 forreturn_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.