Copying/sorting/reshaping

- -
np.copy(arr) Copies arr to new memory
arr.view(dtype) Creates view of arr elements with type dtype
arr.sort() Sorts arr
arr.sort(axis=0) Sorts specific axis of arr
two_d_arr.flatten() Flattens 2D array two_d_arr to 1D
arr.T Transposes arr (rows become columns and vice versa)
arr.reshape(3,4) Reshapes arr to 3 rows, 4 columns without changing data
arr.resize((5,6)) Changes arr shape to 5x6 and fills new values with 0
Comments