Scanpy: Subsetting multiple indices/clusters

Created on 3 Aug 2018  路  2Comments  路  Source: theislab/scanpy

I was trying to subset my dataset based on multiple louvain cluster IDs but it seems to only be possible with one cluster ID at a time. At least I'm getting the following error.

NotImplementedError: Slicing with two indices at the same time is not yet implemented. As a workaround, do row and column slicing succesively.

I'm still new to python and scanpy but would there be a workaround or fix to this? To ease the process I'v inserted what I want to do.

adata_subset = adata[adata.obs['louvain'] == '2', '3']

Most helpful comment

Do

adata_subset = adata[adata.obs['louvain'].isin(['2', '3'])]

All 2 comments

Do

adata_subset = adata[adata.obs['louvain'].isin(['2', '3'])]

Great, thanks!

Was this page helpful?
0 / 5 - 0 ratings