numpy boolean indexing code example
Example 1: integer to boolean numpy
array > 0
#will give True if 1 and false if zero
Example 2: python numpy array boolean indexing
x = np.array([1., -1., -2., 3])
x[x < 0] = 20
x
Output:
array([ 1., 20., 20., 3.])