scanpy.pp.subsample
- scanpy.pp.subsample(data, fraction=None, n_obs=None, random_state=0, copy=False)
Subsample to a fraction of the number of observations.
- Parameters
- data :
AnnData
|ndarray
|spmatrix
Union
[AnnData
,ndarray
,spmatrix
] The (annotated) data matrix of shape
n_obs
×n_vars
. Rows correspond to cells and columns to genes.- fraction :
float
|None
Optional
[float
] (default:None
) Subsample to this
fraction
of the number of observations.- n_obs :
int
|None
Optional
[int
] (default:None
) Subsample to this number of observations.
- random_state :
None
|int
|RandomState
Union
[None
,int
,RandomState
] (default:0
) Random seed to change subsampling.
- copy :
bool
bool
(default:False
) If an
AnnData
is passed, determines whether a copy is returned.
- data :
- Return type
- Returns
Returns
X[obs_indices], obs_indices
if data is array-like, otherwise subsamples the passedAnnData
(copy == False
) or returns a subsampled copy of it (copy == True
).