anndata.acc.MetaAcc#

class anndata.acc.MetaAcc(dim, *, ref_class)[source]#

Bases: RefAcc[R, str | None]

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

index[source]#

Index AdRef, i.e. A.obs.index or A.var.index.

dim: Literal['obs', 'var'][source]#

Axis this accessor refers to, e.g. A.obs.dim == 'obs'.

ref_class: type[AdRef[Hashable]][source]#

Methods

dims(k, /)[source]#

Get along which dimensions the referenced array is.

Return type:

Collection[Literal['obs', 'var']]

get(adata, k, /)[source]#

Get the referenced array from the AnnData object.

Return type:

ExtensionArray | Variable

idx_repr(k)[source]#

Get a string representation of the index.

Return type:

str

isin(adata, idx=None)[source]#

Check if the referenced array is in the AnnData object.

Return type:

bool

process_idx(k, /)[source]#
Return type:

str | None