Series.str.capitalize(self)
[source]
Convert strings in the Series/Index to be capitalized.
Equivalent to str.capitalize()
.
Returns: |
|
---|
See also
Series.str.lower
Series.str.upper
Series.str.title
Series.str.capitalize
Series.str.swapcase
Series.str.casefold
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']) >>> s 0 lower 1 CAPITALS 2 this is a sentence 3 SwApCaSe dtype: object
>>> s.str.lower() 0 lower 1 capitals 2 this is a sentence 3 swapcase dtype: object
>>> s.str.upper() 0 LOWER 1 CAPITALS 2 THIS IS A SENTENCE 3 SWAPCASE dtype: object
>>> s.str.title() 0 Lower 1 Capitals 2 This Is A Sentence 3 Swapcase dtype: object
>>> s.str.capitalize() 0 Lower 1 Capitals 2 This is a sentence 3 Swapcase dtype: object
>>> s.str.swapcase() 0 LOWER 1 capitals 2 THIS IS A SENTENCE 3 sWaPcAsE dtype: object
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.str.capitalize.html