fork download
  1. import numpy as np
  2.  
  3. array_a = np.array([1,2,3,4,5]) # length of 5
  4. array_b = np.array([6,7,8,9,10]) # length of 5
  5.  
  6. condition = array_a>3
  7. print condition
  8. subset_a = array_a[condition]
  9. print subset_a
  10. subset_b = array_b[condition]
  11. print subset_b
Success #stdin #stdout 0.16s 25344KB
stdin
Standard input is empty
stdout
[False False False  True  True]
[4 5]
[ 9 10]