Operations on Numpy Arrays

Reshape the array to a desired size

Note: We can use '-1' as the last dimension during reshape and numpy will figure out the required dimension automatically.

Stacking arrays horizontally and vertically

Mathematical Operations on arrays

Note: If you want to apply a customized function on arrays, make sure to vectorize the function and apply it like inbuilt functions. If you use for loops the power of numpy is lost.

Linear Algebra - Inverse, Determinant, Eigen Values, Dot Product

Swapping elements of numpy array

Transpose of Matrix

If we have a set of data points x1,x2,x3x_1, x_2, x_3 upto xnx_n, stored in array, we can create a design matrix using vstack and transpose.

Thank the author. Fork this blog.


Tagged in pythondata-analysisnumpy