Jun 28, 2024
cd
commandjupyter notebook
np
using import numpy as np
arr1 = np.array([[1, 2, 3], [4, 5, 6]])
axis=0
: column-wise operationsaxis=1
: row-wise operationsarr1.sum(axis=0) # Column wise sum
arr1.sum(axis=1) # Row wise sum
np.dot(arr1, arr2.T) # Transpose second matrix
np.cross
for cross product of vectors
np.cross(arr1, arr2)
np.sort(arr1)
np.sort(arr1, axis=0) # Column-wise sort
kind
parameter
np.sort(arr1, kind='mergesort')