Skip to content

API: return_type argument in StringMethods.split() #9847

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

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:

  1. An expand keyword (or another name), that indicates for False: give same dimension back (so for series/index keep it a series/index), and for True: expand series to dataframe.
    This would then be a duplicate for return_type of course. But the return_type was only introduced in 0.15.1 (and for partition it is still in a PR), so if we want to change this: better now than later. Or has this ship sailed?

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions