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
Post a Comment