Permuting anndata

I am not sure how exactly to permute anndata.
Should I permute each component of it separately like
np.random.permutation(my_adata.obs)
np.random.permutation(my_adata.n_obs),…

I would do adata[np.random.permutation(adata.n_obs)].copy()

1 Like