In [1]: ser = pd.Series(['lORem ipSuM', 'Dolor sit amet', 'Consectetur Adipiscing Elit'])
Convert all to uppercase:
In [2]: ser.str.upper()
Out[2]:
0 LOREM IPSUM
1 DOLOR SIT AMET
2 CONSECTETUR ADIPISCING ELIT
dtype: object
All lowercase:
In [3]: ser.str.lower()
Out[3]:
0 lorem ipsum
1 dolor sit amet
2 consectetur adipiscing elit
dtype: object
Capitalize the first character and lowercase the remaining:
In [4]: ser.str.capitalize()
Out[4]:
0 Lorem ipsum
1 Dolor sit amet
2 Consectetur adipiscing elit
dtype: object
Convert each string to a titlecase (capitalize the first character of each word in each string, lowercase the remaining):
In [5]: ser.str.title()
Out[5]:
0 Lorem Ipsum
1 Dolor Sit Amet
2 Consectetur Adipiscing Elit
dtype: object
Swap cases (convert lowercase to uppercase and vice versa):
In [6]: ser.str.swapcase()
Out[6]:
0 LorEM IPsUm
1 dOLOR SIT AMET
2 cONSECTETUR aDIPISCING eLIT
dtype: object
Aside from these methods that change the capitalization, several methods can be used to check the capitalization of strings.
In [7]: ser = pd.Series(['LOREM IPSUM', 'dolor sit amet', 'Consectetur Adipiscing Elit'])
Check if it is all lowercase:
In [8]: ser.str.islower()
Out[8]:
0 False
1 True
2 False
dtype: bool
Is it all uppercase:
In [9]: ser.str.isupper()
Out[9]:
0 True
1 False
2 False
dtype: bool
Is it a titlecased string:
In [10]: ser.str.istitle()
Out[10]:
0 False
1 False
2 True
dtype: bool