polars.Series.str.to_titlecase#

Series.str.to_titlecase() Series[source]#

Modify strings to their titlecase equivalent.

Notes

This is a form of case transform where the first letter of each word is capitalized, with the rest of the word in lowercase. Non-alphanumeric characters define the word boundaries.

Examples

>>> s = pl.Series(
...     "quotes",
...     [
...         "'e.t. phone home'",
...         "you talkin' to me?",
...         "to infinity,and BEYOND!",
...     ],
... )
>>> s.str.to_titlecase()
shape: (3,)
Series: 'quotes' [str]
[
    "'E.T. Phone Home'"
    "You Talkin' To Me?"
    "To Infinity,And Beyond!"
]