anndata.AnnData.chunk_X

AnnData.chunk_X(select=1000, replace=True)

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

Parameters:
select : int, List[int], Tuple[int, …], ndarrayUnion[int, List[int], Tuple[int, …], ndarray]

If select is an integer, a random chunk of row size = select will be returned. If select is a list, tuple or numpy array of integers, then a chunk with these indices will be returned.

replace : boolbool

If select is an integer then replace=True specifies random sampling of indices with replacement, replace=False - without replacement.