The Pandas Series str function islower() used to determine whether all characters in each elements are lowercase. An empty string considered as False. It returns Series or Index that includes boolean value element-wise.
1 import pandas as pd
2 import numpy as np
3
4 ser = pd.Series(['Python', 'hello', np.nan, '', 'JAVA'])
5
6 print('The original Series object :')
7 print(ser)
8
9 res = ser.str.islower()
10 print('The whether elements are lowercase :')
11 print(res)
In the above example, a Series object is created by passing an array of string. A islower() function is called that determine whether all characters are lowercase. The result is assigned to variable that will be printed on console.
1 The original Series object :
2 0 Python
3 1 hello
4 2 NaN
5 3
6 4 JAVA
7 dtype: object
8 The whether elements are lowercase :
9 0 False
10 1 True
11 2 NaN
12 3 False
13 4 False
14 dtype: object
Example 2
1 import pandas as pd
2
3 ser = pd.Series([' ', 'welcome', 'IOGyan', ''])
4
5 print('The original Series object :')
6 print(ser)
7
8 res = ser.str.islower()
9 print('The whether elements are lowercase :')
10 print(res)
In the above example, a Series object is created by passing an array of string, empty and white spaces string. A islower() function is called that determine whether all characters are lowercase. The result is assigned to variable that will be print.
1 The original Series object :
2 0
3 1 welcome
4 2 IOGyan
5 3
6 dtype: object
7 The whether elements are lowercase :
8 0 False
9 1 True
10 2 False
11 3 False
12 dtype: bool
Related options for your search