pyspark.pandas.Series.str.capitalize

str.capitalize() → pyspark.pandas.series.Series

Convert Strings in the series to be capitalized.

Examples

>>> s = ps.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s
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