SparseArray

class sparse.SparseArray(shape, fill_value=None)[source]

An abstract base class for all the sparse array classes.

dtype

The data type of this array.

Type:

numpy.dtype

fill_value

The fill value of this array.

Type:

scalar

Attributes

SparseArray.density

The ratio of nonzero to all elements in this array.

SparseArray.ndim

The number of dimensions of this array.

SparseArray.nnz

The number of nonzero elements in this array.

SparseArray.size

The number of all elements (including zeros) in this array.

Methods

SparseArray.asformat(format)

Convert this sparse array to a given format.

SparseArray.todense()

Convert this SparseArray array to a dense numpy.ndarray.