anndata.experimental.backed.Dataset2D

Contents

anndata.experimental.backed.Dataset2D#

class anndata.experimental.backed.Dataset2D(ds)[source]#

Bases Mapping[Hashable, DataArray | Dataset2D]

A wrapper class meant to enable working with lazy dataframe data according to AnnData’s internal API. This class ensures that “dataframe-invariants” are respected, namely that there is only one 1d dim and coord with the same name i.e., like a pandas.DataFrame.

You should not have to initiate this class yourself. Setting an xarray.Dataset into a relevant part of the AnnData object will attempt to wrap that object in this object, trying to enforce the “dataframe-invariants.”

Because xarray requires xarray.Dataset.coords to be in-memory, this class provides handling for an out-of-memory index via true_index. This feature is helpful for loading remote data faster where the index itself may not be initially useful for constructing the object e.g., cell ids.

Attributes

columns

AnnData internally looks for columns so this ensures usability

ds

The underlying xarray.Dataset.

dtypes

Return a Series with the dtypes of the variables in the Dataset2D.

iloc

AnnData internally looks for iloc so this ensures usability

index

AnnData internally looks for index so this ensures usability A pandas.Index object corresponding to anndata.experimental.backed.Dataset2D.index_dim :returns: The index of the of the dataframe as resolved from coords.

index_dim

The underlying computational index i.e., the lone coordinate dimension.

is_backed

Check whether or not the object is backed, used to indicate if there are any in-memory objects.

shape

AnnData internally looks for shape so this ensures usability

true_index

true_xr_index as a pandas.Index

true_index_dim

Because xarray loads its coordinates/indexes in memory, we allow for signaling that a given variable, which is not a coordinate, is the "true" index.

true_xr_index

The index AnnData is actually interested in e.g., cell names, for verification.

xr_index

The coordinate of anndata.experimental.backed.Dataset2D.index_dim

Methods

copy([data, deep])

Return a copy of the Dataset2D object.

equals(b)

Thin wrapper around xarray.Dataset.equals()

keys()

reindex([index, axis, fill_value])

Reindex the current object against a new index.

to_memory(*[, copy])

Converts to pandas.DataFrame.