anndata.acc.AdRef

anndata.acc.AdRef#

class anndata.acc.AdRef(acc, idx)[source]#

Bases:

A reference to a 1D or 2D array along one or two dimensions of an AnnData object.

Examples

Use A in the same way you would an AnnData object if you wanted to access a 1D or 2D array along the whole dimension. You can then introspect the reference:

>>> from anndata.acc import A
>>> ref = A.obs["x"]
>>> type(ref)
<class 'anndata.acc.AdRef'>
>>> ref.dims
{'obs'}
>>> ref.idx
'x'
>>> ref.acc
A.obs

See anndata.acc and AdAcc for more examples.

Attributes

dims[source]#

Which dimensions are spanned by the array?

acc: RefAcc[Self, Hashable][source]#

The accessor containing information about this array.

See reference accessors for all possible types this can assume.

idx: Hashable[source]#

The index into the complete array referenced by acc making it 1D or 2D.

E.g. a key of a obs or a Idx2D into a 2D array.