mars.dataframe.Series.str.swapcase#
- Series.str.swapcase()#
将系列/索引中的字符串转换为交换大小写。
等价于
str.swapcase().另请参阅
Series.str.lower将所有字符转换为小写。
Series.str.upper将所有字符转换为大写。
Series.str.title将每个单词的首字母转换为大写,其他字母转换为小写。
Series.str.capitalize将首字母转换为大写,其余字母转换为小写。
Series.str.swapcase将大写字母转换为小写字母,并将小写字母转换为大写字母。
Series.str.casefold消除字符串中的所有大小写区别。
示例
>>> import mars.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: object
>>> s.str.lower().execute() 0 lower 1 capitals 2 this is a sentence 3 swapcase dtype: object
>>> s.str.upper().execute() 0 LOWER 1 CAPITALS 2 THIS IS A SENTENCE 3 SWAPCASE dtype: object
>>> s.str.title().execute() 0 Lower 1 Capitals 2 This Is A Sentence 3 Swapcase dtype: object
>>> s.str.capitalize().execute() 0 Lower 1 Capitals 2 This is a sentence 3 Swapcase dtype: object
>>> s.str.swapcase().execute() 0 LOWER 1 capitals 2 THIS IS A SENTENCE 3 sWaPcAsE dtype: object