Pandas api types function is_bool() in Python
The Pandas api types function is_bool() used to determine whether the specified object is boolean. It returns a boolean value that specifies whether the specified object is boolean.
Syntax
 1 Pandas.api.types.is_bool()
obj : It is an object to determine whether specified object is a boolean.
is_bool() function
 1 from pandas.api.types import is_bool
 2 
 3 res1 = is_bool(True)
 4 print(f'Is it bool object : {res1}')
 5 
 6 res2 = is_bool(1)
 7 print(f'Is it bool object : {res2}')
In the above example, an is_bool() function is called by passing a different values. It returns a boolean value that specifies whether the specified value is boolean. The result is assign to the variable that will be printed on console.
Output
 1 Is it bool object : False
 2 Is it bool object : True

Example 2

Example 2
 1 from pandas.api.types import is_bool
 2 
 3 res1 = is_bool('b')
 4 print(f'Is it bool object : {res1}')
 5 
 6 res2 = is_bool(10 > 5)
 7 print(f'Is it bool object : {res2}')
In the above example, an is_bool() function is called by passing a different values. It returns a boolean value that specifies whether the specified value is boolean. The result is assign to the variable that will be print.
Output
 1 Is it bool object : False
 2 Is it bool object : True

Example 3

Example 3
 1 from pandas.api.types import is_bool
 2 
 3 res1 = is_bool('Hello')
 4 print(f'Is it bool object : {res1}')
 5 
 6 res2 = is_bool(1 == 1)
 7 print(f'Is it bool object : {res2}')
In the above example, an is_bool() function is called by passing a different values. It returns a boolean value that specifies whether the specified value is boolean. The result is assign to the variable that will be print.
Output
 1 Is it bool object : False
 2 Is it bool object : True
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us