Skip to content
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

Series.str.casefold #25405

Closed
selik opened this issue Feb 21, 2019 · 2 comments · Fixed by #25419
Closed

Series.str.casefold #25405

selik opened this issue Feb 21, 2019 · 2 comments · Fixed by #25419
Labels
Enhancement Strings String extension data type and string data
Milestone

Comments

@selik
Copy link
Contributor

selik commented Feb 21, 2019

Series.str.lower implements str.lower, as expected. There are also corresponding Series methods for the other Python 2 string casing methods. However, Python 3's str.casefold is missing. Casefold improves string equality and other comparisons, because it handles a greater variety of characters, as per the Unicode Standard. It'd be nice to have Series.str.casefold in Pandas.

The current alternative is more verbose and is slower than Series.str.lower.

pd.Series(s.casefold() if isinstance(s, str) else s for s in series)

Further, this alternative encourages a frustrating mistake -- forgetting to keep the original Series' index, which causes trouble if the new Series needs to be inserted into the same DataFrame as the original.

Apologies for double-posting. I used the wrong account for #25404 .

@jreback
Copy link
Contributor

jreback commented Feb 21, 2019

can u update with the doc reference for casefold in python docs

@jreback
Copy link
Contributor

jreback commented Feb 21, 2019

certainly would take as an enhancement PR

@mroeschke mroeschke added Enhancement Strings String extension data type and string data labels Feb 22, 2019
@jreback jreback added this to the 0.25.0 milestone Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants