StringMethods.capitalize() SeriesOrIndex#

Convert strings in the Series/Index to be capitalized. This only applies to ASCII characters at this time.

Series or Index of object


>>> import cudf
>>> data = ['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']
>>> s = cudf.Series(data)
>>> s.str.capitalize()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: object
>>> s = cudf.Series(["hello, friend","goodbye, friend"])
>>> s.str.capitalize()
0      Hello, friend
1    Goodbye, friend
dtype: object