Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. arr = array([1,2,3,4,5,6,7,8,9,10])
  2.  
  3. arr[arr>5]
  4.  
  5. array([6,7,8,9,10])
  6.  
  7. >>> import numpy as np
  8. >>> a = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
  9. >>> a
  10. array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
  11.  
  12. >>> mask = a > 5
  13. >>> mask
  14. array([False, False, False, False, False, True, True, True, True,
  15. True])
  16.  
  17. >>> a[0]
  18. 1
  19.  
  20. >>> a[mask]
  21. array([ 6, 7, 8, 9, 10])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement