boolean to numpy array code example
Example 1: integer to boolean numpy
array > 0
#will give True if 1 and false if zero
Example 2: numpy boolean array
arr_1 = np.random.randn(3, 3)
arr_2 = np.random.randn(3, 3)
bool_arr = arr_1 < 0.5
print(bool_arr.dtype)
# output: bool
bool_arr = arr_1 < arr_2
print(bool_arr.dtype)
# output: bool