Docs/Numerical Arrays (NumPy)

Numerical Arrays (NumPy)

NumPy-inspired numerical array library for WebAssembly.

np.testing.assert_
Assert a condition is true.
np.testing.assert_(val, msg?)
np.testing.assert_allclose
Assert that two arrays are element-wise equal within tolerance.
np.testing.assert_allclose(actual, desired, rtol?, atol?, equal_nan?, err_msg?, _verbose?)
np.testing.assert_almost_equal
Assert that two values are equal up to specified decimal places.
np.testing.assert_almost_equal(actual, desired, decimal?, err_msg?, verbose?)
np.testing.assert_approx_equal
Assert values are equal to specified significant figures.
np.testing.assert_approx_equal(actual, desired, significant?, err_msg?, verbose?)
np.testing.assert_array_almost_equal
Assert arrays are element-wise equal up to decimal places.
np.testing.assert_array_almost_equal(x, y, decimal?, err_msg?, verbose?)
np.testing.assert_array_compare
Assert arrays satisfy a custom comparison.
np.testing.assert_array_compare(comparison, x, y, header?, precision?)
np.testing.assert_array_equal
Assert that two arrays are element-wise equal.
np.testing.assert_array_equal(x, y, err_msg?, verbose?)
np.testing.assert_array_less
Assert that all elements of x are strictly less than those of y.
np.testing.assert_array_less(x, y, err_msg?, verbose?)
np.testing.assert_array_max_ulp
Assert arrays differ by at most `maxulp` ULPs.
np.testing.assert_array_max_ulp(a, b, maxulp?, dtype?)
np.testing.assert_equal
Assert that two objects are equal.
np.testing.assert_equal(actual, desired, err_msg?, verbose?)
np.testing.assert_no_warnings
Assert that a function emits no warnings.
np.testing.assert_no_warnings(func, args)
np.testing.assert_raises
Assert that a callable raises the specified exception.
np.testing.assert_raises(exception_class, callable, args)
np.testing.assert_raises_regex
Assert exception is raised with matching message.
np.testing.assert_raises_regex(exception_class, expected_regexp, callable, args)
np.testing.assert_string_equal
Assert that two strings are equal.
np.testing.assert_string_equal(actual, desired)
np.testing.assert_warns
Assert that a function emits a warning.
np.testing.assert_warns(warning_class, callable, args)
np.testing.measure
Measure execution time of a code block.
np.testing.measure(code, times?)
np.testing.print_assert_equal
Print comparison result for debugging.
np.testing.print_assert_equal(test_string, actual, desired)
np.absolute
Calculate the absolute value element-wise.
np.absolute(x)
np.add
Add arguments element-wise.
np.add(x1, x2)
np.all
Test whether all array elements along a given axis evaluate to True.
np.all(a, axis?, keepdims?)
np.allclose
Returns True if two arrays are element-wise equal within a tolerance.
np.allclose(a, b, rtol?, atol?, equal_nan?)
np.angle
Return the angle of the complex argument.
np.angle(z, deg?)
np.any
Test whether any array element along a given axis evaluates to True.
np.any(a, axis?, keepdims?)
np.append
Append values to the end of an array.
np.append(arr, values, axis?)
np.applyAlongAxis
Apply a function to 1-D slices along the given axis.
np.applyAlongAxis(func1d, axis, arr, args)
np.applyOverAxes
Apply a function repeatedly over multiple axes.
np.applyOverAxes(func, arr, axes)
np.arange
Create an NDArray with evenly spaced values within a given interval.
np.arange(start, end?, step?)
np.arccos
Trigonometric inverse cosine, element-wise.
np.arccos(x)
np.arccosh
Inverse hyperbolic cosine, element-wise.
np.arccosh(x)
np.arcsin
Inverse sine, element-wise.
np.arcsin(x)
np.arcsinh
Inverse hyperbolic sine element-wise.
np.arcsinh(x)
np.arctan
Trigonometric inverse tangent, element-wise.
np.arctan(x)
np.arctan2
Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
np.arctan2(x1, x2)
np.arctanh
Inverse hyperbolic tangent element-wise.
np.arctanh(x)
np.argmax
Returns the indices of the maximum values along an axis.
np.argmax(a, axis?, keepdims?)
np.argmin
Returns the indices of the minimum values along an axis.
np.argmin(a, axis?, keepdims?)
np.argpartition
Returns the indices that would partition an array.
np.argpartition(a, kth, axis?)
np.argsort
Returns the indices that would sort an array.
np.argsort(a, axis?, kind?)
np.argwhere
Find the indices of array elements that are non-zero, grouped by element.
np.argwhere(arr)
np.array
Create an NDArray from a nested array or flat array with shape.
np.array(data, shape?, options?)
np.array2string
Return a string representation of an array.
np.array2string(arr, options?)
np.array_equal
True if two arrays have the same shape and elements, False otherwise.
np.array_equal(a1, a2, equal_nan?)
np.array_equiv
Returns True if input arrays are shape consistent and all elements equal.
np.array_equiv(a1, a2)
np.array_split
Split an array into multiple sub-arrays as views.
np.array_split(arr, indices_or_sections, axis?)
np.arrayRepr
Return the string representation of an array (with dtype info).
np.arrayRepr(arr, options?)
np.arrayStr
Return a string representation of an array (no dtype).
np.arrayStr(arr, options?)
np.as_series
Convert input to a list of 1D coefficient arrays.
np.as_series(alist, trim?)
np.asanyarray
Convert the input to an array, passing through ndarrays unchanged.
np.asanyarray(a, options?)
np.asarray
Convert the input to an array.
np.asarray(a, dtype?)
np.asarray_chkfinite
Convert the input to an array, checking for NaNs or Infs.
np.asarray_chkfinite(a, options?)
np.ascontiguousarray
Return a contiguous array (ndim >= 1) in memory (C order).
np.ascontiguousarray(a, options?)
np.asfortranarray
Return a contiguous array (ndim >= 1) in memory (Fortran order).
np.asfortranarray(a, options?)
np.astype
Cast an array to a specified type.
np.astype(a, dtype, copy?)
np.atleast_1d
Convert inputs to arrays with at least one dimension.
np.atleast_1d(arrs)
np.atleast_2d
View inputs as arrays with at least two dimensions.
np.atleast_2d(arrs)
np.atleast_3d
View inputs as arrays with at least three dimensions.
np.atleast_3d(arrs)
np.average
Compute the weighted average along the specified axis.
np.average(a, axis?, weights?, keepdims?)
np.bartlett
Return the Bartlett window.
np.bartlett(M)
np.baseRepr
Return a string representation of a number in the given base.
np.baseRepr(num, base?, padding?)
np.baseReprArray
Convert an array of numbers to base-N representations.
np.baseReprArray(arr, base?, padding?)
np.binaryRepr
Base Conversion Functions
np.binaryRepr(num, width?)
np.binaryReprArray
Convert an array of numbers to binary representations.
np.binaryReprArray(arr, width?)
np.bincount
Count number of occurrences of each value in array of non-negative ints.
np.bincount(x, weights?, minlength?)
np.bitwise_and
Compute the bit-wise AND of two arrays element-wise.
np.bitwise_and(x1, x2)
np.bitwise_count
Computes the number of 1-bits in the absolute value of x.
np.bitwise_count(x)
np.bitwise_or
Compute the bit-wise OR of two arrays element-wise.
np.bitwise_or(x1, x2)
np.bitwise_xor
Compute the bit-wise XOR of two arrays element-wise.
np.bitwise_xor(x1, x2)
np.blackman
Return the Blackman window.
np.blackman(M)
np.block
Assemble an nd-array from nested lists of blocks.
np.block(arrays)
np.broadcastArrays
Broadcast any number of arrays against each other.
np.broadcastArrays(arrays)
np.broadcastShapes
Compute the broadcast shape for two shapes.
np.broadcastShapes(shape1, shape2)
np.broadcastShapesMulti
Compute the broadcast shape for multiple shapes.
np.broadcastShapesMulti(shapes)
np.broadcastTo
Broadcast an array to a target shape.
np.broadcastTo(arr, targetShape)
np.buildIndexSpecs
Build IndexSpec array from parsed indices for C interop.
np.buildIndexSpecs(indices, shape)
np.bytes
Return random bytes.
np.bytes(length)
np.can_cast
Returns true if cast between data types can occur according to the casting rule.
np.can_cast(from, to, casting?)
np.cbrt
Return the cube-root of an array, element-wise.
np.cbrt(x)
np.ceil
Return the ceiling of the input, element-wise.
np.ceil(x)
np.cheb2poly
Convert Chebyshev coefficients to power series.
np.cheb2poly(c)
np.chebadd
Add two Chebyshev polynomials.
np.chebadd(c1, c2)
np.chebcompanion
Generate Chebyshev companion matrix.
np.chebcompanion(c)
np.chebder
Chebyshev derivative.
np.chebder(c, m?)
np.chebdiv
Divide two Chebyshev polynomials.
np.chebdiv(c1, c2)
np.chebfit
Chebyshev least squares fit.
np.chebfit(x, y, deg, rcond?, full?, w?)
np.chebfromroots
Construct Chebyshev polynomial from roots.
np.chebfromroots(roots)
np.chebint
Chebyshev integral.
np.chebint(c, m?, k?, lbnd?)
np.chebinterpolate
Interpolate a function using Chebyshev polynomials.
np.chebinterpolate(func, deg, domain?)
np.chebmul
Multiply two Chebyshev polynomials.
np.chebmul(c1, c2)
np.chebpow
Raise Chebyshev polynomial to a power.
np.chebpow(c, pow, maxpower?)
np.chebroots
Find Chebyshev polynomial roots.
np.chebroots(c)
np.chebsub
Subtract two Chebyshev polynomials.
np.chebsub(c1, c2)
np.chebval
Evaluate Chebyshev polynomial using Clenshaw's algorithm.
np.chebval(x, c)
np.chebval2d
Evaluate 2D Chebyshev polynomial.
np.chebval2d(x, y, c)
np.chebvander
Chebyshev Vandermonde matrix.
np.chebvander(x, deg)
np.choice
Generates a random sample from a given array or range.
np.choice(a, size?, replace?, p?)
np.cholesky
Cholesky decomposition.
np.cholesky(a, upper?)
np.choose
Construct an array from an index array and a set of arrays to choose from.
np.choose(indices, choices, mode?)
np.clip
Clip (limit) the values in an array.
np.clip(a, a_min, a_max)
np.column_stack
Stack 1-D arrays as columns into a 2-D array.
np.column_stack(tup)
np.common_type
Determine common type following standard coercion rules.
np.common_type(dtypes)
np.commonType
Get common type for multiple dtypes.
np.commonType(dtypes)
np.compare_chararrays
Compare two string arrays element-wise.
np.compare_chararrays(x1, x2)
np.compress
Return selected slices of an array along given axis.
np.compress(condition, arr, axis?)
np.computeBroadcastStrides
Compute the strides needed to broadcast an array to a target shape.
np.computeBroadcastStrides(arr, targetShape)
np.computeResultShape
Compute the result shape from index specifications.
np.computeResultShape(specs, shape)
np.concatenate
Join a sequence of arrays along an existing axis.
np.concatenate(arrays, axis?, dtype?)
np.cond
Compute the condition number of a matrix.
np.cond(x, p?)
np.configureWasm
Configure WASM loading before initialization.
np.configureWasm(config)
np.conjugate
Return the complex conjugate, element-wise.
np.conjugate(x)
np.convolve
Returns the discrete, linear convolution of two one-dimensional sequences.
np.convolve(a, v, mode?)
np.copy
Return a copy of an array.
np.copy(a)
np.copysign
Change the sign of x1 to that of x2, element-wise.
np.copysign(x1, x2)
np.copyto
Copy values from one array to another, broadcasting as necessary.
np.copyto(dst, src, _casting?, where?)
np.corrcoef
Return Pearson product-moment correlation coefficients.
np.corrcoef(x, y?, rowvar?)
np.correlate
Cross-correlation of two 1-dimensional sequences.
np.correlate(a, v, mode?)
np.cos
Cosine element-wise.
np.cos(x)
np.cosh
Hyperbolic cosine, element-wise.
np.cosh(x)
np.countNonzero
Count the number of nonzero elements in an array.
np.countNonzero(arr)
np.cov
Estimate a covariance matrix.
np.cov(m, y?, rowvar?, bias?, ddof?)
np.cross
Return the cross product of two (arrays of) vectors.
np.cross(a, b, axisa?, axisb?, axisc?, axis?)
np.cumprod
Return the cumulative product of elements along a given axis.
np.cumprod(a, axis?, dtype?)
np.cumsum
Return the cumulative sum of the elements along a given axis.
np.cumsum(a, axis?, dtype?)
np.cumulative_prod
Return the cumulative product of array elements.
np.cumulative_prod(x, axis?, dtype?, _include_initial?)
np.cumulative_sum
Return the cumulative sum of array elements.
np.cumulative_sum(x, axis?, dtype?, _include_initial?)
np.decode
Decode bytes to strings using specified encoding.
np.decode(a, encoding?)
np.default_rng
Construct a new Generator with the given BitGenerator.
np.default_rng(seed?, options?)
np.degrees
Convert angles from radians to degrees.
np.degrees(x)
np.deleteArr
Return a new array with sub-arrays along an axis deleted.
np.deleteArr(arr, obj, axis?)
np.descrToDtype
Parse NPY descriptor string to DType.
np.descrToDtype(descr)
np.det
Compute the determinant of an array.
np.det(a)
np.diag
Extract a diagonal or construct a diagonal array.
np.diag(v, k?)
np.diag_indices
Return the indices to access the main diagonal of an array.
np.diag_indices(n, ndim?)
np.diag_indices_from
Return the indices to access the main diagonal of an array.
np.diag_indices_from(arr)
np.diagflat
Create a 2D array with the flattened input as a diagonal.
np.diagflat(v, k?, options?)
np.diagonal
Return specified diagonals from a 2D array.
np.diagonal(arr, offset?, axis1?, axis2?)
np.diff
Calculate the n-th discrete difference along the given axis.
np.diff(a, n?, axis?)
np.digitize
Return the indices of the bins to which each value in input array belongs.
np.digitize(x, bins, right?)
np.divide
Divide arguments element-wise (true division).
np.divide(x1, x2)
np.divmod
Return element-wise quotient and remainder simultaneously.
np.divmod(x1, x2)
np.dot
Dot product of two arrays.
np.dot(a, b)
np.dsplit
Split array into multiple sub-arrays along the 3rd axis (depth).
np.dsplit(arr, indices_or_sections)
np.dstack
Stack arrays in sequence along the third axis (depth-wise).
np.dstack(tup)
np.dtypeAlignment
Get natural alignment for a dtype (for C struct compatibility).
np.dtypeAlignment(dtype)
np.dtypeFromString
Convert string dtype name to DType enum.
np.dtypeFromString(name)
np.dtypeSize
Get the size of a dtype in bytes.
np.dtypeSize(dtype)
np.dtypeToDescr
Convert DType to NPY descriptor string.
np.dtypeToDescr(dtype)
np.dtypeToString
Get dtype string name.
np.dtypeToString(dtype)
np.dtypeToTypedArrayConstructor
Get the TypedArray constructor for a given dtype.
np.dtypeToTypedArrayConstructor(dtype)
np.ediff1d
Compute the differences between consecutive elements of an array.
np.ediff1d(arr, options?)
np.eig
Compute eigenvalues and right eigenvectors of a general matrix.
np.eig(a)
np.eigh
Compute eigenvalues and eigenvectors of a Hermitian/symmetric matrix.
np.eigh(a, _UPLO?)
np.eigvals
Compute eigenvalues only.
np.eigvals(a)
np.eigvalsh
Compute eigenvalues of a Hermitian/symmetric matrix.
np.eigvalsh(a, UPLO?)
np.einsum
Evaluates the Einstein summation convention on the operands.
np.einsum(subscripts, operands)
np.einsum_path
Evaluates the lowest cost contraction order for an einsum expression.
np.einsum_path(subscripts, operands)
np.empty
Create a new NDArray without initializing values.
np.empty(shape, options?)
np.empty_like
Create an uninitialized array with the same shape and type as a given array.
np.empty_like(a)
np.encode
Encode strings to bytes using specified encoding.
np.encode(a, _encoding?)
np.endswith
Return true for each element if the string ends with suffix.
np.endswith(a, suffix, start?, end?)
np.equal
Return (x1 == x2) element-wise.
np.equal(x1, x2)
np.exp
Calculate the exponential of all elements in the input array.
np.exp(x)
np.exp2
Calculate 2**x for all elements in the array.
np.exp2(x)
np.expand_dims
Expand the shape of an array by inserting a new axis.
np.expand_dims(a, axis)
np.expandEllipsis
Expand ellipsis and validate index dimensions.
np.expandEllipsis(indices, ndim)
np.expandtabs
Return element-wise copy with tabs expanded to spaces.
np.expandtabs(a, tabsize?)
np.expm1
Calculate exp(x) - 1 for all elements in the array.
np.expm1(x)
np.extract
Return elements of an array that satisfy some condition.
np.extract(condition, arr)
np.eye
Create a 2D array with ones on the diagonal and zeros elsewhere.
np.eye(N, M?, k?, options?)
np.fft
Compute the one-dimensional discrete Fourier Transform.
np.fft(a, n?, axis?, norm?)
np.fft2
Compute the 2-dimensional discrete Fourier Transform.
np.fft2(a, s?, axes?, norm?)
np.fftfreq
Return the Discrete Fourier Transform sample frequencies.
np.fftfreq(n, d?)
np.fftn
Compute the N-dimensional discrete Fourier Transform.
np.fftn(a, s?, axes?, norm?)
np.fftshift
Shift the zero-frequency component to the center of the spectrum.
np.fftshift(x, axes?)
np.fill_diagonal
Fill the main diagonal of the given array of any dimensionality.
np.fill_diagonal(a, val, wrap?)
np.find_duplicate
Find duplicate elements in a list.
np.find_duplicate(list)
np.flatnonzero
Return flat indices of nonzero elements.
np.flatnonzero(arr)
np.flatten
Return a copy of the array collapsed into one dimension.
np.flatten(a)
np.flip
Reverse the order of elements in an array along the given axis.
np.flip(arr, axis?)
np.fliplr
Reverse the order of elements along axis 1 (left/right).
np.fliplr(arr)
np.flipud
Reverse the order of elements along axis 0 (up/down).
np.flipud(arr)
np.float_power
First array elements raised to powers from second array, element-wise.
np.float_power(x1, x2)
np.floor
Return the floor of the input, element-wise.
np.floor(x)
np.floor_divide
Return the largest integer smaller or equal to the division of the inputs.
np.floor_divide(x1, x2)
np.fmax
Element-wise maximum (ignores NaN).
np.fmax(x1, x2)
np.fmin
Element-wise minimum (ignores NaN).
np.fmin(x1, x2)
np.fmod
Returns element-wise remainder of floor_divide (C-style modulo).
np.fmod(x1, x2)
np.formatFloatPositional
Format a float in positional notation.
np.formatFloatPositional(value, precision?, _unique?, fractional?, trim?, sign?, padLeft?, padRight?)
np.formatFloatScientific
Format a float in scientific notation.
np.formatFloatScientific(value, precision?, _unique?, trim?, sign?, padLeft?, expDigits?)
np.formatValue
Format a number according to printf-style format string.
np.formatValue(value, fmt)
np.frexp
Decompose the elements of x into mantissa and twos exponent.
np.frexp(x)
np.fromBaseRepr
Convert a base-N string to a number.
np.fromBaseRepr(str, base?)
np.fromBinaryRepr
Convert a binary string to a number.
np.fromBinaryRepr(binary, twosComplement?, width?)
np.frombuffer
Interpret a buffer as a 1-dimensional array.
np.frombuffer(buffer, options?)
np.fromfile
Construct an array from data in a binary file.
np.fromfile(file, options?)
np.fromfunction
Construct an array by executing a function over each coordinate.
np.fromfunction(func, shape, options?)
np.fromiter
Create a 1D array from an iterable object.
np.fromiter(iter, options?)
np.frompyfunc
Create a ufunc-like wrapper from a JavaScript function.
np.frompyfunc(func, nin, nout, identity?)
np.fromregex
Construct an array from a text file using regular expression parsing.
np.fromregex(file, regexp, dtype?, options?)
np.fromstring
Create a 1D array from text data in a string.
np.fromstring(string, sep?, count?, options?)
np.full
Create a new NDArray filled with a constant value.
np.full(shape, fillValue, options?)
np.full_like
Create an array filled with a value, with the same shape and type as a given array.
np.full_like(a, fillValue)
np.gcd
Returns the greatest common divisor of |x1| and |x2|.
np.gcd(x1, x2)
np.genfromtxt
Load data from a text file with handling for missing values.
np.genfromtxt(file, options?)
np.geomspace
Create an NDArray with numbers spaced evenly on a geometric scale.
np.geomspace(start, stop, num?, endpoint?, options?)
np.getBitGenerator
Get a BitGenerator class by name.
np.getBitGenerator(name)
np.getdomain
Get the domain appropriate for given data points.
np.getdomain(x)
np.getPrintoptions
Get current print options.
np.getPrintoptions()
np.getWasmModule
Get the loaded WASM module synchronously.
np.getWasmModule()
np.gradient
Return the gradient of an N-dimensional array.
np.gradient(f, args)
np.greater
Return (x1 > x2) element-wise.
np.greater(x1, x2)
np.greater_equal
Return (x1 >= x2) element-wise.
np.greater_equal(x1, x2)
np.hamming
Return the Hamming window.
np.hamming(M)
np.hanning
Return the Hanning window (also known as Hann window).
np.hanning(M)
np.heaviside
Compute the Heaviside step function.
np.heaviside(x1, x2)
np.herm2poly
Convert Hermite coefficients to power series.
np.herm2poly(c)
np.hermadd
hermadd
np.hermadd(c1, c2)
np.hermcompanion
hermcompanion
np.hermcompanion(c)
np.hermder
hermder
np.hermder(c, m?)
np.hermdiv
hermdiv
np.hermdiv(c1, c2)
np.herme2poly
Convert HermiteE coefficients to power series.
np.herme2poly(c)
np.hermeadd
hermeadd
np.hermeadd(c1, c2)
np.hermecompanion
hermecompanion
np.hermecompanion(c)
np.hermeder
hermeder
np.hermeder(c, m?)
np.hermediv
hermediv
np.hermediv(c1, c2)
np.hermefit
hermefit
np.hermefit(x, y, deg, rcond?, full?, w?)
np.hermefromroots
hermefromroots
np.hermefromroots(roots)
np.hermeint
hermeint
np.hermeint(c, m?, k?, lbnd?)
np.hermemul
hermemul
np.hermemul(c1, c2)
np.hermepow
hermepow
np.hermepow(c, pow, maxpower?)
np.hermeroots
hermeroots
np.hermeroots(c)
np.hermesub
hermesub
np.hermesub(c1, c2)
np.hermeval
Evaluate HermiteE polynomial.
np.hermeval(x, c)
np.hermevander
hermevander
np.hermevander(x, deg)
np.hermfit
hermfit
np.hermfit(x, y, deg, rcond?, full?, w?)
np.hermfromroots
hermfromroots
np.hermfromroots(roots)
np.hermint
hermint
np.hermint(c, m?, k?, lbnd?)
np.hermmul
hermmul
np.hermmul(c1, c2)
np.hermpow
hermpow
np.hermpow(c, pow, maxpower?)
np.hermroots
hermroots
np.hermroots(c)
np.hermsub
hermsub
np.hermsub(c1, c2)
np.hermval
Evaluate Hermite polynomial.
np.hermval(x, c)
np.hermvander
hermvander
np.hermvander(x, deg)
np.hexRepr
Return the hexadecimal representation of a number.
np.hexRepr(num, width?)
np.hfft
Compute the FFT of a signal that has Hermitian symmetry (real spectrum).
np.hfft(a, n?, axis?, norm?)
np.histogram
Compute the histogram of a dataset.
np.histogram(a, bins?, range?, density?, weights?)
np.histogram2d
Compute the bi-dimensional histogram of two data samples.
np.histogram2d(x, y, bins?, range?, density?, weights?)
np.histogram_bin_edges
Compute histogram bin edges.
np.histogram_bin_edges(a, bins?, range?, weights?)
np.histogramdd
Compute the multidimensional histogram of some data.
np.histogramdd(sample, bins?, range?, density?, weights?)
np.hsplit
Split an array into multiple sub-arrays horizontally (column-wise).
np.hsplit(arr, indices_or_sections)
np.hstack
Stack arrays in sequence horizontally (column-wise).
np.hstack(tup)
np.hypot
Given the "legs" of a right triangle, return its hypotenuse.
np.hypot(x1, x2)
np.i0
Modified Bessel function of the first kind, order 0.
np.i0(x)
np.identity
Create a square identity matrix.
np.identity(n, options?)
np.ifft
Compute the one-dimensional inverse discrete Fourier Transform.
np.ifft(a, n?, axis?, norm?)
np.ifft2
Compute the 2-dimensional inverse discrete Fourier Transform.
np.ifft2(a, s?, axes?, norm?)
np.ifftn
Compute the N-dimensional inverse discrete Fourier Transform.
np.ifftn(a, s?, axes?, norm?)
np.ifftshift
The inverse of fftshift.
np.ifftshift(x, axes?)
np.ihfft
Compute the inverse FFT of a signal that has Hermitian symmetry.
np.ihfft(a, n?, axis?, norm?)
np.imag
Return the imaginary part of the complex argument.
np.imag(val)
np.in1d
Test whether each element of ar1 is also present in ar2 (flat version).
np.in1d(ar1, ar2, options?)
np.indices
Return an array representing the indices of a grid.
np.indices(dimensions, dtype?, sparse?)
np.initRandom
Initialize the random module.
np.initRandom()
np.inner
Inner product of two arrays.
np.inner(a, b)
np.insert
Insert values along the given axis before the given indices.
np.insert(arr, obj, values, axis?)
np.interp
One-dimensional linear interpolation for monotonically increasing sample points.
np.interp(x, xp, fp, left?, right?)
np.intersect1d
Find the intersection of two arrays.
np.intersect1d(ar1, ar2, options?)
np.inv
Compute the (multiplicative) inverse of a matrix.
np.inv(a)
np.invert
Compute bit-wise inversion, element-wise.
np.invert(x)
np.irfft
Compute the inverse of the one-dimensional discrete Fourier Transform for real input.
np.irfft(a, n?, axis?, norm?)
np.irfft2
Compute the inverse of the 2-dimensional FFT of real input.
np.irfft2(a, s?, axes?, norm?)
np.irfftn
Compute the inverse of the N-dimensional FFT of real input.
np.irfftn(a, s?, axes?, norm?)
np.isalnum
Return true for each element if all characters are alphanumeric.
np.isalnum(a)
np.isalpha
Return true for each element if all characters are alphabetic.
np.isalpha(a)
np.isBoolDType
Check if dtype is boolean.
np.isBoolDType(dtype)
np.isclose
Returns a boolean array where two arrays are element-wise equal within tolerance.
np.isclose(a, b, rtol?, atol?, equal_nan?)
np.iscomplex
Returns a bool array where True if input element is complex (imaginary part != 0).
np.iscomplex(x)
np.isComplexDType
Check if dtype is a complex type.
np.isComplexDType(dtype)
np.iscomplexobj
Check if the array has a complex dtype.
np.iscomplexobj(x)
np.isdecimal
Return true for each element if all characters are decimal.
np.isdecimal(a)
np.isdigit
Return true for each element if all characters are digits (0-9).
np.isdigit(a)
np.isdtype
Returns a boolean indicating whether the provided dtype is of the specified kind.
np.isdtype(dtype, kind)
np.isfinite
Test element-wise for finiteness (not infinity and not NaN).
np.isfinite(x)
np.isFloatDType
Check if dtype is a floating point type.
np.isFloatDType(dtype)
np.isfortran
Check if the array is Fortran contiguous but not C contiguous.
np.isfortran(a)
np.isin
Test whether each element of ar1 is also present in ar2.
np.isin(ar1, ar2, options?)
np.isinf
Test element-wise for positive or negative infinity.
np.isinf(x)
np.isIntegerDType
Check if dtype is an integer type (signed or unsigned).
np.isIntegerDType(dtype)
np.islower
Return true for each element if all cased characters are lowercase
np.islower(a)
np.isnan
Test element-wise for NaN.
np.isnan(x)
np.isneginf
Test element-wise for negative infinity.
np.isneginf(x)
np.isNode
Check if running in Node.js environment.
np.isNode()
np.isnumeric
Return true for each element if all characters are numeric.
np.isnumeric(a)
np.isNumericDType
Check if dtype is numeric (not bool).
np.isNumericDType(dtype)
np.isposinf
Test element-wise for positive infinity.
np.isposinf(x)
np.isreal
Returns a bool array where True if input element is real (imaginary part == 0).
np.isreal(x)
np.isrealobj
Check if the array has a non-complex dtype.
np.isrealobj(x)
np.isscalar
Check if an element is a scalar type.
np.isscalar(element)
np.isSignedDType
Check if dtype is a signed type.
np.isSignedDType(dtype)
np.isspace
Return true for each element if all characters are whitespace.
np.isspace(a)
np.isStructuredDType
Type guard for structured dtypes.
np.isStructuredDType(dtype)
np.issubdtype
Return true if first argument is a typecode lower/equal in type hierarchy.
np.issubdtype(arg1, arg2)
np.istitle
Return true for each element if the string is titlecased.
np.istitle(a)
np.isupper
Return true for each element if all cased characters are uppercase
np.isupper(a)
np.isWasmLoaded
Check if the WASM module has been loaded.
np.isWasmLoaded()
np.iterable
Check whether the object is iterable.
np.iterable(y)
np.ix_
Construct an open mesh from multiple sequences.
np.ix_(args)
np.kaiser
Return the Kaiser window.
np.kaiser(M, beta)
np.kron
Kronecker product of two arrays.
np.kron(a, b)
np.lag2poly
Convert Laguerre coefficients to power series.
np.lag2poly(c)
np.lagadd
lagadd
np.lagadd(c1, c2)
np.lagcompanion
lagcompanion
np.lagcompanion(c)
np.lagder
lagder
np.lagder(c, m?)
np.lagdiv
lagdiv
np.lagdiv(c1, c2)
np.lagfit
lagfit
np.lagfit(x, y, deg, rcond?, full?, w?)
np.lagfromroots
lagfromroots
np.lagfromroots(roots)
np.lagint
lagint
np.lagint(c, m?, k?, lbnd?)
np.lagmul
lagmul
np.lagmul(c1, c2)
np.lagpow
lagpow
np.lagpow(c, pow, maxpower?)
np.lagroots
lagroots
np.lagroots(c)
np.lagsub
lagsub
np.lagsub(c1, c2)
np.lagval
Evaluate Laguerre polynomial.
np.lagval(x, c)
np.lagvander
lagvander
np.lagvander(x, deg)
np.lcm
Returns the lowest common multiple of |x1| and |x2|.
np.lcm(x1, x2)
np.ldexp
Returns x1 * 2^x2, element-wise.
np.ldexp(x1, x2)
np.left_shift
Shift the bits of an integer to the left.
np.left_shift(x1, x2)
np.leg2poly
Convert Legendre coefficients to power series.
np.leg2poly(c)
np.legadd
Add two Legendre polynomials.
np.legadd(c1, c2)
np.legcompanion
Generate Legendre companion matrix.
np.legcompanion(c)
np.legder
Legendre derivative.
np.legder(c, m?)
np.legdiv
Divide two Legendre polynomials.
np.legdiv(c1, c2)
np.legfit
Legendre least squares fit.
np.legfit(x, y, deg, rcond?, full?, w?)
np.legfromroots
Construct Legendre polynomial from roots.
np.legfromroots(roots)
np.legint
Legendre integral.
np.legint(c, m?, k?, lbnd?)
np.legmul
Multiply two Legendre polynomials.
np.legmul(c1, c2)
np.legpow
Raise Legendre polynomial to a power.
np.legpow(c, pow, maxpower?)
np.legroots
Find Legendre polynomial roots.
np.legroots(c)
np.legsub
Subtract two Legendre polynomials.
np.legsub(c1, c2)
np.legval
Evaluate Legendre polynomial using Clenshaw-like algorithm.
np.legval(x, c)
np.legvander
Legendre Vandermonde matrix.
np.legvander(x, deg)
np.less
Return (x1 < x2) element-wise.
np.less(x1, x2)
np.less_equal
Return (x1 <= x2) element-wise.
np.less_equal(x1, x2)
np.lexsort
Perform an indirect stable sort using a sequence of keys.
np.lexsort(keys)
np.linspace
Create an NDArray with evenly spaced numbers over a specified interval.
np.linspace(start, stop, num?, endpoint?, options?)
np.listBitGenerators
List available BitGenerator names.
np.listBitGenerators()
np.ljust
Return element-wise left-justified string of given width.
np.ljust(a, width, fillchar?)
np.load
Load an array from a NPY file.
np.load(file, _options?)
np.loadtxt
Load data from a text file.
np.loadtxt(file, options?)
np.loadWasmModule
Load the WASM module asynchronously.
np.loadWasmModule()
np.loadz
Load arrays from a `.npz` file.
np.loadz(file)
np.log
Natural logarithm, element-wise.
np.log(x)
np.log10
Base-10 logarithm, element-wise.
np.log10(x)
np.log1p
Return the natural logarithm of one plus the input array, element-wise.
np.log1p(x)
np.log2
Base-2 logarithm of x.
np.log2(x)
np.logaddexp
Compute the logarithm of the sum of exponentials of the inputs.
np.logaddexp(x1, x2)
np.logaddexp2
Compute log(2**x1 + 2**x2).
np.logaddexp2(x1, x2)
np.logical_and
Compute the truth value of x1 AND x2 element-wise.
np.logical_and(x1, x2)
np.logical_not
Compute the truth value of NOT x element-wise.
np.logical_not(x)
np.logical_or
Compute the truth value of x1 OR x2 element-wise.
np.logical_or(x1, x2)
np.logical_xor
Compute the truth value of x1 XOR x2, element-wise.
np.logical_xor(x1, x2)
np.logspace
Create an NDArray with numbers spaced evenly on a log scale.
np.logspace(start, stop, num?, endpoint?, base?, options?)
np.lower
Return element-wise copy with uppercase characters converted to lowercase.
np.lower(a)
np.lstrip
Return element-wise copy with leading characters removed.
np.lstrip(a, chars?)
np.lstsq
Return the least-squares solution to a linear matrix equation.
np.lstsq(a, b, rcond?)
np.mapdomain
Map x from old domain to new domain.
np.mapdomain(x, old, new_)
np.mapparms
Get linear mapping parameters between domains.
np.mapparms(old, new_)
np.mask_indices
Return indices that are non-zero in the mask.
np.mask_indices(n, func, k?)
np.matmul
Matrix multiplication of two arrays.
np.matmul(a, b)
np.matrix_norm
Compute the matrix norm.
np.matrix_norm(x, ord?, keepdims?)
np.matrix_power
Raise a square matrix to the (integer) power n.
np.matrix_power(a, n)
np.matrix_rank
Return matrix rank using SVD method.
np.matrix_rank(A, tol?)
np.matrix_transpose
Transposes the last two dimensions of an array.
np.matrix_transpose(x)
np.matvec
Matrix-vector product.
np.matvec(x1, x2)
np.max
Return the maximum of an array or maximum along an axis.
np.max(a, axis?, keepdims?)
np.maximum
Element-wise maximum of array elements (propagates NaN).
np.maximum(x1, x2)
np.mean
Compute the arithmetic mean along the specified axis.
np.mean(a, axis?, keepdims?, dtype?)
np.median
Compute the median along the specified axis.
np.median(a, axis?, keepdims?)
np.meshgrid
Return coordinate matrices from coordinate vectors.
np.meshgrid(xi)
np.min
Return the minimum of an array or minimum along an axis.
np.min(a, axis?, keepdims?)
np.min_scalar_type
Return the minimum scalar type needed to represent the value.
np.min_scalar_type(value)
np.minimum
Element-wise minimum of array elements (propagates NaN).
np.minimum(x1, x2)
np.modf
Return the fractional and integral parts of an array, element-wise.
np.modf(x)
np.moveaxis
Move axes of an array to new positions.
np.moveaxis(a, source, destination)
np.multi_dot
Compute the dot product of two or more arrays in a single function call,
np.multi_dot(arrays)
np.multiply
Multiply arguments element-wise.
np.multiply(x1, x2)
np.nan_to_num
Replace NaN with zero and infinity with large finite numbers.
np.nan_to_num(x, nan?, posinf?, neginf?)
np.nanargmax
Return the indices of the maximum values along an axis, ignoring NaNs.
np.nanargmax(a, axis?, keepdims?)
np.nanargmin
Return the indices of the minimum values along an axis, ignoring NaNs.
np.nanargmin(a, axis?, keepdims?)
np.nancumprod
Return the cumulative product of array elements treating NaNs as one.
np.nancumprod(a, axis?, dtype?)
np.nancumsum
Return the cumulative sum of array elements treating NaNs as zero.
np.nancumsum(a, axis?, dtype?)
np.nanmax
Return maximum of an array or maximum along an axis, ignoring any NaNs.
np.nanmax(a, axis?, keepdims?)
np.nanmean
Compute the arithmetic mean along the specified axis, ignoring NaNs.
np.nanmean(a, axis?, keepdims?, dtype?)
np.nanmedian
Compute the median along the specified axis, while ignoring NaNs.
np.nanmedian(a, axis?, keepdims?)
np.nanmin
Return minimum of an array or minimum along an axis, ignoring any NaNs.
np.nanmin(a, axis?, keepdims?)
np.nanpercentile
Compute the q-th percentile of the data along the specified axis,
np.nanpercentile(a, q, axis?, interpolation?, keepdims?)
np.nanprod
Return the product of array elements over a given axis treating NaNs as one.
np.nanprod(a, axis?, keepdims?, _dtype?)
np.nanquantile
Compute the q-th quantile of the data along the specified axis,
np.nanquantile(a, q, axis?, interpolation?, keepdims?)
np.nanstd
Compute the standard deviation along the specified axis, ignoring NaNs.
np.nanstd(a, axis?, ddof?, keepdims?, dtype?)
np.nansum
Return the sum of array elements over a given axis treating NaNs as zero.
np.nansum(a, axis?, keepdims?, dtype?)
np.nanvar
Compute the variance along the specified axis, while ignoring NaNs.
np.nanvar(a, axis?, ddof?, keepdims?, dtype?)
np.ndenumerate
Iterate over array with indices and values.
np.ndenumerate(arr)
np.ndindex
Generate all index combinations for a shape.
np.ndindex(shape)
np.nditer
Iterate over array elements.
np.nditer(arr)
np.negative
Numerical negative, element-wise.
np.negative(x)
np.nextafter
Return the next floating-point value after x1 towards x2, element-wise.
np.nextafter(x1, x2)
np.nonzero
Find indices of nonzero elements.
np.nonzero(arr)
np.norm
Matrix or vector norm.
np.norm(x, ord?)
np.not_equal
Return (x1 != x2) element-wise.
np.not_equal(x1, x2)
np.octalRepr
Return the octal representation of a number.
np.octalRepr(num, width?)
np.ones
Create a new NDArray filled with ones.
np.ones(shape, options?)
np.ones_like
Create an array of ones with the same shape and type as a given array.
np.ones_like(a)
np.openMemmap
Open a memory-mapped file.
np.openMemmap(file, options?)
np.outer
Compute the outer product of two vectors.
np.outer(a, b)
np.packbits
Pack the elements of a binary array into bits in a uint8 array.
np.packbits(a, axis?, bitorder?)
np.pad
Pad an array.
np.pad(arr, pad_width, mode?, constant_values?)
np.partition
Return a partitioned copy of an array.
np.partition(a, kth, axis?)
np.percentile
Compute the q-th percentile of the data along the specified axis.
np.percentile(a, q, axis?, keepdims?)
np.permutation
Randomly permute a sequence, or return a permuted range.
np.permutation(x, axis?)
np.permute_dims
Permute the dimensions of an array.
np.permute_dims(a, axes?)
np.piecewise
Evaluate a piecewise-defined function.
np.piecewise(x, condlist, funclist, args)
np.pinv
Compute the (Moore-Penrose) pseudo-inverse of a matrix.
np.pinv(a, rcond?)
np.place
Change elements of an array based on conditional and input values.
np.place(arr, mask, vals)
np.poly
Find the coefficients of a polynomial with the given sequence of roots.
np.poly(seq_of_zeros)
np.poly2cheb
Convert power series coefficients to Chebyshev coefficients.
np.poly2cheb(pol)
np.poly2herm
Convert power series to Hermite coefficients.
np.poly2herm(pol)
np.poly2herme
Convert power series to HermiteE coefficients.
np.poly2herme(pol)
np.poly2lag
Convert power series to Laguerre coefficients.
np.poly2lag(pol)
np.poly2leg
Convert power series to Legendre coefficients.
np.poly2leg(pol)
np.polyadd
Add two coefficient arrays (power series).
np.polyadd(c1, c2)
np.polycompanion
Generate companion matrix.
np.polycompanion(c)
np.polyder
Polynomial derivative.
np.polyder(c, m?)
np.polydiv
Divide two coefficient arrays (power series).
np.polydiv(c1, c2)
np.polyfit
Least squares polynomial fit.
np.polyfit(x, y, deg, rcond?, full?, w?)
np.polyfromroots
Construct polynomial from roots.
np.polyfromroots(roots)
np.polyint
Polynomial integral.
np.polyint(c, m?, k?, lbnd?)
np.polymul
Multiply two coefficient arrays (power series).
np.polymul(c1, c2)
np.polypow
Raise polynomial to a non-negative integer power.
np.polypow(c, pow, maxpower?)
np.polyroots
Find polynomial roots.
np.polyroots(c)
np.polysub
Subtract two coefficient arrays (power series).
np.polysub(c1, c2)
np.polyval
Evaluate polynomial at x using Horner's method.
np.polyval(x, c)
np.polyval2d
Evaluate 2D polynomial on x-y pairs.
np.polyval2d(x, y, c)
np.polyval3d
Evaluate 3D polynomial on x-y-z triples.
np.polyval3d(x, y, z, c)
np.polyvander
Generate Vandermonde matrix.
np.polyvander(x, deg)
np.polyvander2d
Generate 2D Vandermonde matrix.
np.polyvander2d(x, y, deg)
np.positive
Numerical positive (returns a copy).
np.positive(x)
np.power
First array elements raised to powers from second array, element-wise.
np.power(x1, x2)
np.prod
Return the product of array elements over a given axis.
np.prod(a, axis?, keepdims?, dtype?)
np.promoteTypes
Get result type when combining two dtypes.
np.promoteTypes(dtype1, dtype2)
np.ptp
Range of values (maximum - minimum) along an axis.
np.ptp(a, axis?, keepdims?)
np.put
Put values into an array at specified flat indices.
np.put(arr, indices, values, mode?)
np.put_along_axis
Put values into the destination array by matching 1d index and data slices.
np.put_along_axis(arr, indicesArr, values, axis)
np.putmask
Change elements of an array based on conditional and input values.
np.putmask(arr, mask, values)
np.qr
QR decomposition.
np.qr(a)
np.quantile
Compute the q-th quantile of the data along the specified axis.
np.quantile(a, q, axis?, keepdims?)
np.radians
Convert angles from degrees to radians.
np.radians(x)
np.rand
Random values in a given shape.
np.rand(shape)
np.randint
Return random integers from low (inclusive) to high (exclusive).
np.randint(low, high?, size?)
np.randn
Draw samples from a standard normal distribution.
np.randn(args)
np.random
Return random floats in the half-open interval [0.0, 1.0).
np.random(size?)
np.random_integers
Return random integers from low (inclusive) to high (exclusive).
np.random_integers(low, high?, size?)
np.random_sample
Return random floats in the half-open interval [0.0, 1.0).
np.random_sample(size?)
np.ranf
Return random floats in the half-open interval [0.0, 1.0).
np.ranf(size?)
np.ravel
Return a contiguous flattened array.
np.ravel(a)
np.ravelMultiIndex
Convert a tuple of coordinate arrays into flat indices.
np.ravelMultiIndex(coords, shape)
np.real
Return the real part of the complex argument.
np.real(val)
np.real_if_close
If input is complex with all imaginary parts close to zero, return real parts.
np.real_if_close(a, tol?)
np.recArray
Create a record array.
np.recArray(data?, options?)
np.recFromarrays
Create a record array from a list of arrays (columns).
np.recFromarrays(arrayList, options?)
np.recFromfile
Create a record array from a file.
np.recFromfile(file, dtype, shape?, offset?)
np.recFromrecords
Create a record array from a list of records (rows).
np.recFromrecords(recList, options?)
np.recFromstring
Create a record array from a binary string/buffer.
np.recFromstring(datastring, dtype, shape?, offset?)
np.reciprocal
Return the reciprocal of the argument, element-wise.
np.reciprocal(x)
np.remainder
Return element-wise remainder of division (Python-style modulo).
np.remainder(x1, x2)
np.repeat
Repeat elements of an array.
np.repeat(arr, repeats, axis?)
np.resetPrintoptions
Reset print options to defaults.
np.resetPrintoptions()
np.reshape
Gives a new shape to an array without changing its data.
np.reshape(a, newshape)
np.resize
Return a new array with the specified shape.
np.resize(arr, new_shape)
np.result_type
Return the type that results from applying the type promotion rules to the arguments.
np.result_type(dtypes)
np.rfft
Compute the one-dimensional discrete Fourier Transform for real input.
np.rfft(a, n?, axis?, norm?)
np.rfft2
Compute the 2-dimensional FFT of a real array.
np.rfft2(a, s?, axes?, norm?)
np.rfftfreq
Return the Discrete Fourier Transform sample frequencies for rfft.
np.rfftfreq(n, d?)
np.rfftn
Compute the N-dimensional discrete Fourier Transform for real input.
np.rfftn(a, s?, axes?, norm?)
np.rfind
For each element, return the highest index where substring is found.
np.rfind(a, sub, start?, end?)
np.right_shift
Shift the bits of an integer to the right.
np.right_shift(x1, x2)
np.rindex
Like rfind, but raises ValueError if substring is not found.
np.rindex(a, sub, start?, end?)
np.rint
Round elements of the array to the nearest integer.
np.rint(x)
np.rjust
Return element-wise right-justified string of given width.
np.rjust(a, width, fillchar?)
np.roll
Roll array elements along a given axis.
np.roll(arr, shift, axis?)
np.rollaxis
Roll the specified axis backwards, until it lies in a given position.
np.rollaxis(a, axis, start?)
np.roots
Find the roots of a polynomial with coefficients given in c.
np.roots(p)
np.rot90
Rotate an array by 90 degrees in the plane specified by axes.
np.rot90(arr, k?, axes?)
np.round
Round to nearest even value (banker's rounding).
np.round(x)
np.rpartition
Partition each element around the last occurrence of sep.
np.rpartition(a, sep)
np.rstrip
Return element-wise copy with trailing characters removed.
np.rstrip(a, chars?)
np.sample
Return random floats in the half-open interval [0.0, 1.0).
np.sample(size?)
np.save
Save an array to a binary file in NPY format.
np.save(file, arr, _options?)
np.savetxt
Save an array to a text file.
np.savetxt(file, arr, options?)
np.savez
Save multiple arrays to a single file in uncompressed `.npz` format.
np.savez(file, args)
np.savez_compressed
Save multiple arrays to a single file in compressed `.npz` format.
np.savez_compressed(file, args)
np.searchsorted
Find indices where elements should be inserted to maintain order.
np.searchsorted(a, v, side?)
np.seed
Seed the default random generator.
np.seed(seed)
np.select
Return an array drawn from elements in choicelist, depending on conditions.
np.select(condlist, choicelist, defaultValue?)
np.setdiff1d
Find the set difference of two arrays.
np.setdiff1d(ar1, ar2, options?)
np.setPrintoptions
Set printing options globally.
np.setPrintoptions(options)
np.setxor1d
Find the set exclusive-or of two arrays.
np.setxor1d(ar1, ar2, options?)
np.shapesAreBroadcastable
Check if two shapes are broadcast-compatible.
np.shapesAreBroadcastable(shape1, shape2)
np.shuffle
Randomly shuffle elements of an array in-place along an axis.
np.shuffle(x, axis?)
np.sign
Returns element-wise sign: -1, 0, or +1.
np.sign(x)
np.signbit
Return element-wise True where signbit is set (less than zero).
np.signbit(x)
np.sin
Trigonometric sine, element-wise.
np.sin(x)
np.sinc
Return the normalized sinc function: sin(pi*x) / (pi*x).
np.sinc(x)
np.sinh
Hyperbolic sine, element-wise.
np.sinh(x)
np.slice
Factory function for creating slices with cleaner syntax.
np.slice(start?, stop?, step?)
np.slogdet
Compute sign and (natural) logarithm of the determinant.
np.slogdet(a)
np.solve
Solve a linear matrix equation: a @ x = b
np.solve(a, b)
np.sort
Return a sorted copy of an array.
np.sort(a, axis?, kind?)
np.sort_complex
Sort a complex array using the real part first, then the imaginary part.
np.sort_complex(a)
np.spacing
Return the distance between x and the nearest adjacent number.
np.spacing(x)
np.split
Split an array into multiple sub-arrays of equal size.
np.split(arr, indices_or_sections, axis?)
np.sqrt
Return the non-negative square-root of an array, element-wise.
np.sqrt(x)
np.square
Return the element-wise square of the input.
np.square(x)
np.squeeze
Remove axes of length one from array.
np.squeeze(a, axis?)
np.stack
Join a sequence of arrays along a new axis.
np.stack(arrays, axis?)
np.startswith
Return true for each element if the string starts with prefix.
np.startswith(a, prefix, start?, end?)
np.std
Compute the standard deviation along the specified axis.
np.std(a, axis?, ddof?, keepdims?, dtype?)
np.str_len
Return the length of each element.
np.str_len(a)
np.strAdd
Return element-wise string concatenation.
np.strAdd(x1, x2)
np.strCapitalize
Return element-wise copy with first character capitalized and rest lowercase.
np.strCapitalize(a)
np.strCenter
Return element-wise centered string of given width.
np.strCenter(a, width, fillchar?)
np.strCount
Return the number of non-overlapping occurrences of substring.
np.strCount(a, sub, start?, end?)
np.strEqual
Return (x1 == x2) element-wise for string arrays.
np.strEqual(x1, x2)
np.strFind
For each element, return the lowest index where substring is found.
np.strFind(a, sub, start?, end?)
np.strGreater
Return (x1 > x2) element-wise for string arrays.
np.strGreater(x1, x2)
np.strGreaterEqual
Return (x1 >= x2) element-wise for string arrays.
np.strGreaterEqual(x1, x2)
np.strIndex
Like find, but raises ValueError if substring is not found.
np.strIndex(a, sub, start?, end?)
np.strip
Return element-wise copy with leading and trailing characters removed.
np.strip(a, chars?)
np.strLess
Return (x1 < x2) element-wise for string arrays.
np.strLess(x1, x2)
np.strLessEqual
Return (x1 <= x2) element-wise for string arrays.
np.strLessEqual(x1, x2)
np.strMod
Return element-wise (a % i), i.e. string formatting.
np.strMod(a, values)
np.strMultiply
Return element-wise (a * i), string repeated i times.
np.strMultiply(a, i)
np.strNotEqual
Return (x1 != x2) element-wise for string arrays.
np.strNotEqual(x1, x2)
np.strPartition
Partition each element around the first occurrence of sep.
np.strPartition(a, sep)
np.strReplace
Return element-wise copy with occurrences of old replaced by new.
np.strReplace(a, old, new_, count?)
np.strSlice
Return element-wise sliced strings.
np.strSlice(a, start?, stop?, step?)
np.strTitle
Return element-wise titlecased version.
np.strTitle(a)
np.strTranslate
Return element-wise translation of string using a translation table.
np.strTranslate(a, table, deletechars?)
np.structDtypeSize
Get byte size for a given dtype.
np.structDtypeSize(dtype)
np.subtract
Subtract arguments, element-wise.
np.subtract(x1, x2)
np.sum
Sum of array elements over a given axis.
np.sum(a, axis?, keepdims?, dtype?)
np.svd
Singular Value Decomposition.
np.svd(a, fullMatrices?)
np.svdvals
Return singular values only.
np.svdvals(a)
np.swapaxes
Interchange two axes of an array.
np.swapaxes(a, axis1, axis2)
np.swapcase
Return element-wise copy with uppercase and lowercase swapped.
np.swapcase(a)
np.take
Take elements from an array along an axis.
np.take(arr, indices, axis?, mode?)
np.take_along_axis
Take values from the input array by matching 1d index and data slices.
np.take_along_axis(arr, indicesArr, axis)
np.takeFlat
Take elements from a flattened array.
np.takeFlat(arr, indices, mode?)
np.tan
Compute tangent element-wise.
np.tan(x)
np.tanh
Compute hyperbolic tangent element-wise.
np.tanh(x)
np.tensordot
Compute tensor dot product along specified axes.
np.tensordot(a, b, axes?)
np.tensorinv
Compute the 'inverse' of an N-dimensional array.
np.tensorinv(a, ind?)
np.tensorsolve
Solve the tensor equation a x = b for x.
np.tensorsolve(a, b, axes?)
np.tile
Construct an array by repeating arr the number of times given by reps.
np.tile(arr, reps)
np.trace
Return the sum along diagonals of the array.
np.trace(a, offset?, axis1?, axis2?)
np.transpose
Reverse or permute the axes of an array.
np.transpose(a, axes?)
np.trapezoid
Integrate along the given axis using the composite trapezoidal rule.
np.trapezoid(y, x?, dx?, axis?)
np.tri
Create a 2D array with ones at and below the given diagonal.
np.tri(N, M?, k?, options?)
np.tril
Lower triangle of an array.
np.tril(arr, k?)
np.tril_indices
Return the indices for the lower-triangle of an (n, m) array.
np.tril_indices(n, k?, m?)
np.tril_indices_from
Return the indices for the lower-triangle of an (n, m) array.
np.tril_indices_from(arr, k?)
np.trim_zeros
Trim the leading and/or trailing zeros from a 1-D array.
np.trim_zeros(arr, trim?)
np.trimcoef
Remove small trailing coefficients.
np.trimcoef(c, tol?)
np.trimseq
Remove trailing zeros from a sequence.
np.trimseq(seq)
np.triu
Upper triangle of an array.
np.triu(arr, k?)
np.triu_indices
Return the indices for the upper-triangle of an (n, m) array.
np.triu_indices(n, k?, m?)
np.triu_indices_from
Return the indices for the upper-triangle of an (n, m) array.
np.triu_indices_from(arr, k?)
np.trunc
Return the truncated value of the input, element-wise.
np.trunc(x)
np.typedArrayToDType
Infer DType from a TypedArray.
np.typedArrayToDType(arr)
np.union1d
Find the union of two arrays.
np.union1d(ar1, ar2)
np.unique
Find the unique elements of an array.
np.unique(arr, options?)
np.uniqueAll
Return unique values, indices, inverse, and counts.
np.uniqueAll(arr)
np.uniqueCounts
Return unique values and their counts.
np.uniqueCounts(arr)
np.uniqueIndex
Return unique values and indices of first occurrence.
np.uniqueIndex(arr)
np.uniqueInverse
Return unique values and indices to reconstruct original.
np.uniqueInverse(arr)
np.uniqueValues
Return only the unique values (simplified interface).
np.uniqueValues(arr)
np.unpackbits
Unpack elements of a uint8 array into a binary array.
np.unpackbits(a, axis?, count?, bitorder?)
np.unravelIndex
Convert a flat index into a tuple of coordinate arrays.
np.unravelIndex(indices, shape)
np.unstack
Unpack the array along a given axis.
np.unstack(arr, axis?)
np.unwrap
Unwrap by taking the complement of large deltas with respect to the period.
np.unwrap(p, discont?, axis?, period?)
np.upper
Return element-wise copy with lowercase characters converted to uppercase.
np.upper(a)
np.vander
Generate a Vandermonde matrix.
np.vander(x, N?, increasing?, options?)
np.variance
Compute the variance along the specified axis.
np.variance(a, axis?, ddof?, keepdims?, dtype?)
np.vdot
Compute the dot product of two vectors (flattened inputs).
np.vdot(a, b)
np.vecdot
Compute the vector dot product of two arrays along the last axis.
np.vecdot(x1, x2, axis?)
np.vecmat
Vector-matrix product.
np.vecmat(x1, x2)
np.vector_norm
Compute the vector norm.
np.vector_norm(x, ord?, axis?, keepdims?)
np.vectorize
Factory function for creating a Vectorize instance.
np.vectorize(pyfunc, options?)
np.vsplit
Split an array into multiple sub-arrays vertically (row-wise).
np.vsplit(arr, indices_or_sections)
np.vstack
Stack arrays in sequence vertically (row-wise).
np.vstack(tup)
np.where
Return elements chosen from x or y depending on condition.
np.where(condition, x?, y?)
np.withPrintoptions
Execute a function with temporary print options.
np.withPrintoptions(options, fn)
np.zeros
Create a new NDArray filled with zeros.
np.zeros(shape, options?)
np.zeros_like
Create an array of zeros with the same shape and type as a given array.
np.zeros_like(a)
np.zfill
Return element-wise numeric string left-padded with zeros.
np.zfill(a, width)