Answers for "numpy boolean array with index true"

1

python numpy array boolean indexing

x = np.array([1., -1., -2., 3])
x[x < 0] = 20
x

Output:
array([  1.,  20.,  20.,   3.])
Posted by: Guest on October-15-2020

Code answers related to "numpy boolean array with index true"

Python Answers by Framework

Browse Popular Code Answers by Language