Numpy create boolean array from checking if an array index equal a letter -


i have numpy array of letters 'x' , 'y'. how make boolean array returns true if index == 'x' , false otherwise?

in [1]: import numpy np  in [2]: = np.array(['x', 'y', 'y', 'x', 'y'])  in [3]: == 'x' out[3]: array([ true, false, false,  true, false], dtype=bool) 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

ios - Possible to get UIButton sizeThatFits to work? -