Built-in Functions

StevenSwiniarski's avatar
Published May 25, 2022
Contribute to Docs

NumPy has many built-in functions for mathematical operations and array manipulation. Selected ones are listed below.

Built-in Functions

.amax()
Returns the maximum of a given array or maximum along an axis.
.amin()
Returns the minimum of an array or minimum along an axis.
.append()
Appends values to the end of an array.
.argmax()
Returns the indices of the maximum values along a specified axis in an array
.argmin()
Finds the index of the minimum value in a NumPy array, either across the entire array or along a specified axis.
.corrcoef()
Computes the Pearson correlation coefficient of two specified arrays.
.cumsum()
Computes the cumulative sum of elements in an array along a specified axis.
.det()
Computes the determinant of a square matrix.
.dot()
Computes the dot product of two arrays.
.inv()
Inverts a given matrix and returns the inverted matrix.
.linspace()
Returns an array of evenly-spaced numbers over a given interval.
.log()
Returns an element-wise natural logarithm for an array.
.mean()
Calculates the arithmetic mean of elements in a NumPy array along the specified axis.
.median()
Returns the median of the elements in a given array.
.norm()
Computes the norm of a matrix, either across the entire array or along a specified axis.
.percentile()
Calculates the Xth percentile of the given data.
.quantile()
Computes the qth quantile of the input array along the specified axis.
.repeat()
Duplicates elements in an array along a given axis.
.reshape()
Changes the shape of a NumPy array without altering its data or total size.
.sort()
Sorts an array in ascending order along the specified axis and returns a sorted copy of the input array.
.split()
Divides an array into separate sub-arrays along a specified axis.
.std()
Calculates the standard deviation of given data along a specified axis.
.sum()
Sums the elements of an array over a given axis.
.svd()
Performs the Singular Value Decomposition (SVD) on a matrix, breaking it down into singular vectors and singular values.
.tile()
Constructs a new array by repeating the input array’s elements a specified number of times.
.trace()
Calculates the sum of the elements along the main diagonal of an array.
.transpose()
Reverses or permutes the axes of an ndarray.
.var()
Computes the variance of the array elements.

All contributors

Contribute to Docs

Learn Python:NumPy on Codecademy

close