Skip to content

ENH: Index StringMethods should return MultiIndex when result dimension is more than one #10008

@mortada

Description

@mortada
Contributor

Currently the Index.str methods only support returning Index results. However, analogous to the expansion from Series.str.* -> DataFrame, we should be able to do Index.str.* -> MultiIndex in certain cases, as discussed in #9870 (comment)

Some of the string methods that can support this are: str.get_dummies, str.extract, str.split

Here are the related PRs: #9667, #9843, #9870, #9985

Activity

added this to the 0.17.0 milestone on Apr 29, 2015
sinhrks

sinhrks commented on May 6, 2015

@sinhrks
Member

I should have comment here... #9773 is going to have a general logic for expand. Affected methods (in future) are summarized in #9870.

sinhrks

sinhrks commented on May 9, 2015

@sinhrks
Member

I understand current status is:
-> Checklist is moved to the top.

modified the milestones: Next Major Release, 0.17.0 on Aug 15, 2015
sinhrks

sinhrks commented on May 7, 2016

@sinhrks
Member

Index.str.extractall raises AttributeError. Just fix and close.

idx = pd.Index(["a1a2", "b1", "c1"], ["A", "B", "C"])
idx.str.extractall("[ab](?P<digit>\d)")
# AttributeError: 'Index' object has no attribute 'iteritems'

CC: @tdhock

modified the milestones: 0.18.2, Next Major Release on May 7, 2016
jreback

jreback commented on May 7, 2016

@jreback
Contributor

thanks @sinhrks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignMaster TrackerHigh level tracker for similar issuesStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @jreback@mortada@sinhrks

      Issue actions

        ENH: Index StringMethods should return MultiIndex when result dimension is more than one · Issue #10008 · pandas-dev/pandas