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

Comments

@selik
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2019

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

@jreback

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2019

certainly would take as an enhancement PR

@charlesdong1991 charlesdong1991 referenced this issue Feb 23, 2019

Merged

ENH: Add Series.str.casefold #25419

4 of 4 tasks complete

@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
Projects
None yet
3 participants
You can’t perform that action at this time.