pyspark.pandas.Series.str.swapcase

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

Convert strings in the Series/Index to be swapcased.

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.swapcase()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: object