Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # Rank 1 array:
  2. vector.shape = (n,) # Not a row, not a column either, can't .T it
  3.  
  4. dataframe[column] => (n,)
  5. dataframe[[column]] => (n,1)
  6.  
  7. vector.flatten # produce a rank 1 array
  8.  
  9. vector.reshape(-1, 1) # produces a column vector. With -1, numpy calculate itself the length of the column
  10.  
  11. np.expand_dims(image, 2) # Add a 3rd dimension, from (a,b) to (a,b,1)
  12.  
  13. # Check size
  14. assert(w.shape == (dim, 1))
  15.  
  16. # Check type
  17. assert(isinstance(b, float) or isinstance(b, int))
  18.  
  19. # Warning with reshape
  20. a.reshape(a.shape[0], -1).T != a.reshape(-1, a.shape[0]) # not sure why, but when it reshapes, it has do to it in some order, which might not be the one we want
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement