pandas.Series.str.title#
- Series.str.title()[source]#
Convert strings in the Series/Index to titlecase.
Equivalent to
str.title().- Returns:
- Series or Index of objects
A Series or Index where the strings are modified by
str.title().
See also
Series.str.lowerConverts all characters to lowercase.
Series.str.upperConverts all characters to uppercase.
Series.str.titleConverts first character of each word to uppercase and remaining to lowercase.
Series.str.capitalizeConverts first character to uppercase and remaining to lowercase.
Series.str.swapcaseConverts uppercase to lowercase and lowercase to uppercase.
Series.str.casefoldRemoves all case distinctions in the string.
Examples
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']) >>> s 0 lower 1 CAPITALS 2 this is a sentence 3 SwApCaSe dtype: str
>>> s.str.lower() 0 lower 1 capitals 2 this is a sentence 3 swapcase dtype: str
>>> s.str.upper() 0 LOWER 1 CAPITALS 2 THIS IS A SENTENCE 3 SWAPCASE dtype: str
>>> s.str.title() 0 Lower 1 Capitals 2 This Is A Sentence 3 Swapcase dtype: str
>>> s.str.capitalize() 0 Lower 1 Capitals 2 This is a sentence 3 Swapcase dtype: str
>>> s.str.swapcase() 0 LOWER 1 capitals 2 THIS IS A SENTENCE 3 sWaPcAsE dtype: str