Numpy Flashcards
1
Q
Numpy: Flip ndarray upside down
A
np.flipud(matrix)
2
Q
Numpy: Transpose a ndarray
A
arr.T
3
Q
Numpy: Flip ndarray left right
A
np.fliplr(matrix)
4
Q
Numpy: Rotate ndarray by 90 degrees
A
np.rot90(matrix)
5
Q
Numpy: View the numbers stored in the memory of a ndarray
A
np.ravel(arr)
6
Q
Numpy: View the numbers stored in the memory of a ndarray using C or Fortran methods
A
np. ravel(order=”C”)
np. ravel(order=”F”)
7
Q
Numpy: Convert a ndarray to int32
A
arr.astype(“int32”)
8
Q
Numpy: Remove all singleton dimensions
A
np.squeeze(arr)