In this example we will show how to change data type from integer to boolean in Python NumPy.
Source Code
import numpy as np
n = np.array([1, 5, 0])
convert_to_bool = n.astype(bool)
print(convert_to_bool)
print(convert_to_bool.dtype)
Output:
[ True True False]
bool