anndata.AnnData.chunk_X

anndata.AnnData.chunk_X#

AnnData.chunk_X(select=1000, replace=True)[source]#

Return a chunk of the data matrix X with random or specified indices.

Parameters:
select int | Sequence[int] | ndarray (default: 1000)

Depending on the type:

int

A random chunk with select rows will be returned.

sequence (e.g. a list, tuple or numpy array) of int

A chunk with these indices will be returned.

replace bool (default: True)

If select is an integer then True means random sampling of indices with replacement, False without replacement.