scanpy.pp.subsample#
- scanpy.pp.subsample(data, fraction=None, *, n_obs=None, random_state=0, copy=False)[source]#
Subsample to a fraction of the number of observations.
Deprecated since version 1.11.0: Use
sample()instead.- Parameters:
- data
AnnData|ndarray|csr_array|csc_array|csr_matrix|csc_matrix The (annotated) data matrix of shape
n_obs×n_vars. Rows correspond to cells and columns to genes.- fraction
float|None(default:None) Subsample to this
fractionof the number of observations.- n_obs
int|None(default:None) Subsample to this number of observations.
- random_state
int|RandomState|None(default:0) Random seed to change subsampling.
- copy
bool(default:False) If an
AnnDatais passed, determines whether a copy is returned.
- data
- Return type:
AnnData|tuple[ndarray|csr_array|csc_array|csr_matrix|csc_matrix,ndarray[tuple[int,...],dtype[int64]]] |None- Returns:
Returns
X[obs_indices], obs_indicesif data is array-like, otherwise subsamples the passedAnnData(copy == False) or returns a subsampled copy of it (copy == True).