Numpy tutorial - vanhoan310/tips GitHub Wiki

np.linspace(a,b,n)

Compute max and argmax:

a.max(), a.argmax()

Indices

x = np.arange(20).reshape(5, 4) row, col = np.indices((2, 3)) x[row, col] array([[0, 1, 2], [4, 5, 6]])