pyspark.pandas.Series.str.title

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

将系列中的字符串转换为首字母大写。

示例

>>> 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.title()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: object