anndata.acc.MetaAcc#
- class anndata.acc.MetaAcc(dim, *, ref_class)[source]#
Bases:
RefAcc[R,str|None,MuData|AnnData]Reference accessor for arrays from metadata containers (
A.obs/A.var).Examples
You can refer to columns or the index in the way you would access them in a
DataFrame:>>> from anndata.acc import A, MetaAcc >>> assert isinstance(A.obs, MetaAcc) >>> A.obs["type"] A.obs['type'] >>> A.var.index A.var.index
Attributes
Methods
- dims(k, /)[source]#
Get along which dimensions the referenced array is.
- Return type:
Collection[Literal['obs','var']]
- get(data, k=NO_IDX, /)[source]#
- Overloads:
self, data (MuData | AnnData) → DataFrameLike
self, data (MuData | AnnData), k (str | None) → pd.api.extensions.ExtensionArray | XVariable
Get the indexed array from the AnnData object at
idx.When
idxis omitted (i.e.,idxisNO_IDX), return the full array one level up instead. This has the same semantics as theAdRefpath but one level up:adata[A.obs]returns the fullDataFrameandadata[A.obsm["pca"]]the fullnumpy.ndarray. These both have definedshape-like properties (orawkward.Array), unlike, for example,obsmor similar.