Five Simple NumPy Functions
What is NumPy?
NumPy is an open source project aiming to enable numerical computing with Python and builds on (and is a successor to) the successful Numeric array object.
It provides two fundamental objects: an N-dimensional array object (ndarray
) and a universal function object (ufunc
). In addition, there are other objects that build on top of these.
The current notebook will only provide a brief outline of five NumPy functions which is important to get a very rough idea about a data-set:
- np.linalg.solve
- np.nonzero
- np.random.randint
- np.median
- np.corrcoef
Where the numpy
package has been imported under the alias np
.
import numpy as np
Function 1 - np.linalg.solve
What is the general form?
np.linalg.solve(A, b)
What is the output?
Computes the exact solution, of the well-determined, i.e., full rank, linear matrix equation, or system of linear scalar equations of the form: , where coefficient matrix is a 2-d array and is a 1-d or 2-d array of ordinates or dependent variable values.