Answers for "python numpy array boolean indexing"

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

Python Answers by Framework

Browse Popular Code Answers by Language