anndata.abc.CSRDataset#
- class anndata.abc.CSRDataset[source]#
Bases:
ABCOn disk CSR sparse matrix.
Analogous to
h5py.Datasetorzarr.Array, but for sparse matrices.Attributes
- dtype[source]#
The
numpy.dtypeof thedataattribute of the sparse matrix.
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.
- index
- Return type:
float|csr_matrix|csc_matrix|csr_array|csc_array- Returns:
The desired data read off disk.
- abstractmethod append(sparse_matrix)[source]#
Append an in-memory or on-disk sparse matrix to the current object’s store.
- Parameters:
- sparse_matrix
csr_matrix|csc_matrix|csr_array|csc_array|CSRDataset|CSCDataset The matrix to append.
- sparse_matrix
- Raises:
NotImplementedError – If the matrix to append is not one of
csr_array,csc_array,csr_matrix, orcsc_matrix.ValueError – If both the on-disk and to-append matrices are not of the same format i.e.,
csrorcsc.OverflowError – If the underlying data store has a 32 bit indptr, and the new matrix is too large to fit in it i.e., would cause a 64 bit
indptrto be written.AssertionError – If the on-disk data does not have
cscorcsrformat.
- Return type: