SHARE
TWEET

slice numpy

furas Aug 5th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. A = np.array(range(3))
  4.  
  5. B = A[:2]
  6. print(A, B)
  7.  
  8. B[0] = 9
  9. print(A, B)
  10.  
  11. A[0] = 5
  12. print(A, B)
  13.  
  14. # [0 1 2] [0 1]
  15. # [9 1 2] [9 1]
  16. # [5 1 2] [5 1]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top