Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. >>> import numpy as np
  2.  
  3. >>> arr = np.random.randint(0, 2, size=(2, 2, 2))
  4.  
  5. >>> arr
  6.  
  7. array([[[0, 0],
  8. [1, 0]],
  9.  
  10. [[1, 1],
  11. [1, 0]]])
  12.  
  13. >>> arr == 1
  14.  
  15. array([[[False, False],
  16. [ True, False]],
  17.  
  18. [[ True, True],
  19. [ True, False]]], dtype=bool)
  20.  
  21. >>> arr == (1, )
  22.  
  23. array([[[False, False],
  24. [ True, False]],
  25.  
  26. [[ True, True],
  27. [ True, False]]], dtype=bool)
  28.  
  29. >>> arr == (1, 1)
  30.  
  31. array([[[False, False],
  32. [ True, False]],
  33.  
  34. [[ True, True],
  35. [ True, False]]], dtype=bool)
  36.  
  37. >>> arr == (1, 1, 1)
  38. /Users/mperry/env/mapbox35/bin/ipython:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
  39. #!/Users/mperry/env/mapbox35/bin/python3.5
  40. False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement