API

Description

Classes

COO(coords[, data, shape, has_duplicates, …])

A sparse multidimensional array.

DOK(shape[, data, dtype, fill_value])

A class for building sparse multidimensional arrays.

SparseArray(shape[, fill_value])

An abstract base class for all the sparse array classes.

Functions

argwhere(a)

Find the indices of array elements that are non-zero, grouped by element.

as_coo(x[, shape, fill_value])

Converts any given format to COO.

concatenate(arrays[, axis, compressed_axes])

Concatenate the input arrays along the given dimension.

clip(a[, a_min, a_max, out])

Clip (limit) the values in the array.

diagonal(a[, offset, axis1, axis2])

Extract diagonal from a COO array.

diagonalize(a[, axis])

Diagonalize a COO array.

dot(a, b)

Perform the equivalent of numpy.dot on two arrays.

elemwise(func, *args, **kwargs)

Apply a function to any number of arguments.

eye(N[, M, k, dtype, format, compressed_axes])

Return a 2-D array in the specified format with ones on the diagonal and zeros elsewhere.

full(shape, fill_value[, dtype, format, …])

Return a SparseArray of given shape and type, filled with fill_value.

full_like(a, fill_value[, dtype, format, …])

Return a full array with the same shape and type as a given array.

isposinf(x[, out])

Test element-wise for positive infinity, return result as sparse bool array.

isneginf(x[, out])

Test element-wise for negative infinity, return result as sparse bool array.

kron(a, b)

Kronecker product of 2 sparse arrays.

load_npz(filename)

Load a sparse matrix in numpy’s .npz format from disk.

matmul(a, b)

Perform the equivalent of numpy.matmul on two arrays.

moveaxis(a, source, destination)

Move axes of an array to new positions.

nanmax(x[, axis, keepdims, dtype, out])

Maximize along the given axes, skipping NaN values.

nanmean(x[, axis, keepdims, dtype, out])

Performs a NaN skipping mean operation along the given axes.

nanmin(x[, axis, keepdims, dtype, out])

Minimize along the given axes, skipping NaN values.

nanprod(x[, axis, keepdims, dtype, out])

Performs a product operation along the given axes, skipping NaN values.

nanreduce(x, method[, identity, axis, keepdims])

Performs an NaN skipping reduction on this array.

nansum(x[, axis, keepdims, dtype, out])

Performs a NaN skipping sum operation along the given axes.

ones(shape[, dtype, format, compressed_axes])

Return a SparseArray of given shape and type, filled with ones.

ones_like(a[, dtype, format, compressed_axes])

Return a SparseArray of ones with the same shape and type as a.

outer(a, b[, out])

Return outer product of two sparse arrays.

random(shape[, density, nnz, random_state, …])

Generate a random sparse multidimensional array

result_type(*arrays_and_dtypes)

Returns the type that results from applying the NumPy type promotion rules to the arguments.

roll(a, shift[, axis])

Shifts elements of an array along specified axis.

save_npz(filename, matrix[, compressed])

Save a sparse matrix to disk in numpy’s .npz format.

stack(arrays[, axis, compressed_axes])

Stack the input arrays along the given dimension.

tensordot(a, b[, axes, return_type])

Perform the equivalent of numpy.tensordot.

tril(x[, k])

Returns an array with all elements above the k-th diagonal set to zero.

triu(x[, k])

Returns an array with all elements below the k-th diagonal set to zero.

where(condition[, x, y])

Select values from either x or y depending on condition.

zeros(shape[, dtype, format, compressed_axes])

Return a SparseArray of given shape and type, filled with zeros.

zeros_like(a[, dtype, format, compressed_axes])

Return a SparseArray of zeros with the same shape and type as a.