Answers for "integer numpy array to bool numpy array"

0

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])
Posted by: Guest on April-29-2020
0

integer to boolean numpy

array > 0
#will give True if 1 and false if zero
Posted by: Guest on April-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language