Can not select part of the adata.obs (corresponding to a library_id)

I try to modify my adata.obs according to the library_id.

I don’t understand why, there are both dataframe …
Many thanks !!!

hi @sophieRAIBAUD , this is because you are assigning 1 to a view of the anndata (the subsetted one by 132_...). This is nothing specifically to squidpy but more generally to anndata and how views are handled in python (numpy, dataframes). In order to reproduce that behaviour correctly, I would do something like this

adata.obs["test"] = adata.obs["my_annotation"].replace({"132_...":"10", "132_1...":"1"})


great, this is working correctly !
now I want to fill the library id with different number (I have done the nuclei segmentation and got 1 nmber per raw in .obsm:

do you have an idea how to do it ?
Many thanks !!

I Finally mangaged with a series of concat and merge
thanks for the advice !