numpy how to convert bool to 0 and 1 s code example
Example: numpy convert true false to 0 1
array([False, False, True, True], dtype=bool)
>>> 1*y # Method 1
array([0, 0, 1, 1])
>>> y.astype(int) # Method 2
array([0, 0, 1, 1])