anndata.abc.CSRDataset#

class anndata.abc.CSRDataset[source]#

Bases: ABC

On disk CSR sparse matrix.

Analogous to h5py.Dataset or zarr.Array, but for sparse matrices.

Attributes

format: ClassVar[Literal['csr', 'csc']] = 'csr'[source]#

The format of the sparse matrix.

shape: tuple[int, int][source]#

Shape of the matrix.

dtype: dtype[source]#

The numpy.dtype of the data attribute of the sparse matrix.

backend: Literal['zarr', 'hdf5'][source]#

Which file type is used on-disk.

Methods

abstractmethod __getitem__(index)[source]#

Load a slice or an element from the sparse dataset into memory.

Parameters:
index anndata.typing.Index

Index to load.

Return type:

float | csr_matrix | csc_matrix | csr_array | csc_array

Returns:

The desired data read off disk.

abstractmethod to_memory()[source]#

Load the sparse dataset into memory.

Return type:

csr_matrix | csc_matrix | csr_array | csc_array

Returns:

The in-memory representation of the sparse dataset.