python - numpy get column indices where all elements are greater than threshold -


i want find column indices of numpy array elements of column greater threshold value.

for example,

 x = array([[ 0.16,  0.40,  0.61,  0.48,  0.20],             [ 0.42,  0.79,  0.64,  0.54,  0.52],             [ 0.64,  0.64,  0.24,  0.63,  0.43],             [ 0.33,  0.54,  0.61,  0.43,  0.29],             [ 0.25,  0.56,  0.42,  0.69,  0.62]]) 

in above case, if threshold 0.4, result should 1,3.

you can compare against min of each column using np.where:

large = np.where(x.min(0) >= 0.4)[0] 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -