8000 ENH/BUG: str.extractall doesn't support index by sinhrks · Pull Request #13156 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@sinhrks
Copy link
Member
@sinhrks sinhrks commented May 12, 2016
# same output as pd.Series(["a1a2", "b1", "c1"]).str.extractall("[ab](?P<digit>\d)")
idx = pd.Index(["a1a2", "b1", "c1"])
idx.str.extractall("[ab](?P<digit>\d)")
#         digit
#   match      
#0 0         1
#   1         2
#1 0         1

NOTE Also fixed a bug Series.str.extractall raises ValueError if its Index is str with 2 or more characters.

s = pd.Series(["a1a2", "b1", "c1"], index=pd.Index(["xx", "yy", "zz"]))
s.str.extractall("[ab](?P<digit>\d)")
# ValueError: Length of names must match number of levels in MultiIndex.

@sinhrks sinhrks added Bug Enhancement Strings String extension data type and string data labels May 12, 2016
@sinhrks sinhrks added this to the 0.18.2 milestone May 12, 2016
@sinhrks
Copy link
Member Author
sinhrks commented May 12, 2016

CC: @tdhock

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a DataFrame

a Series.str.extractall

with a default index

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed these.

@jreback
Copy link
Contributor
jreback commented May 13, 2016

thanks @sinhrks very nice!

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

Labels

Bug Enhancement Strings String extension data type and string data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants

0