Open WeilerP opened 7 months ago
To me, this kind of use case is covered by sc.get.obs_df
. Is there some reason that doesn't do what you need?
Alternatively, adata.to_df().join(adata.obs)
To me, this kind of use case is covered by
sc.get.obs_df
. Is there some reason that doesn't do what you need?
It requires Scanpy instead of using AnnData directly. And yes, you can always merge the relevant columns; it'd just be easier via an argument.
It requires Scanpy instead of using AnnData directly.
Just to establish an alternative: if sc.get.obs_df
instead lived in anndata
, that would be sufficient?
Please describe your wishes and possible alternatives to achieve the desired result.
Description
AnnData.to_df
only converts data from.X
or a layer to a DataFrame. It'd be great to also add metadata column fromAnnData.obs
. This feature would make it easier to work with Pandasgroupby
on the generated DataFrame, for example.