maxframe.dataframe.Series.str.title#

Series.str.title()#

将 Series/Index 中的字符串转换为标题格式。

等效于 str.title()

返回:

A Series or Index where the strings are modified by str.title().

返回类型:

Series or Index of objects

参见

Series.str.lower

将所有字符转换为小写。

Series.str.upper

将所有字符转换为大写。

Series.str.title

将每个单词的第一个字符转换为大写,其余字符转换为小写。

Series.str.capitalize

将第一个字符转换为大写,其余字符转换为小写。

Series.str.swapcase

将大写转换为小写,小写转换为大写。

Series.str.casefold

移除字符串中的所有大小写区别。

示例

>>> import maxframe.dataframe as md
>>> s = md.Series(["lower", "CAPITALS", "this is a sentence", "SwApCaSe"])
>>> s.execute()
0                 lower
1              CAPITALS
2    this is a sentence
3              SwApCaSe
dtype: str
>>> s.str.lower().execute()
0                 lower
1              capitals
2    this is a sentence
3              swapcase
dtype: str
>>> s.str.upper().execute()
0                 LOWER
1              CAPITALS
2    THIS IS A SENTENCE
3              SWAPCASE
dtype: str
>>> s.str.title().execute()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: str
>>> s.str.capitalize().execute()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: str
>>> s.str.swapcase().execute()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: str