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 apandas.DataFrame.You should not have to initiate this class yourself. Setting an
xarray.Datasetinto a relevant part of theAnnDataobject will attempt to wrap that object in this object, trying to enforce the “dataframe-invariants.”Because xarray requires
xarray.Dataset.coordsto be in-memory, this class provides handling for an out-of-memory index viatrue_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
AnnDatainternally looks forcolumnsso this ensures usabilityThe underlying
xarray.Dataset.Return a Series with the dtypes of the variables in the Dataset2D.
AnnDatainternally looks forindexso this ensures usability Apandas.Indexobject corresponding toanndata.experimental.backed.Dataset2D.index_dim:returns: The index of the of the dataframe as resolved fromcoords.The underlying computational index i.e., the lone coordinate dimension.
Check whether or not the object is backed, used to indicate if there are any in-memory objects.
AnnDatainternally looks forshapeso this ensures usabilityBecause xarray loads its coordinates/indexes in memory, we allow for signaling that a given variable, which is not a coordinate, is the "true" index.
The index
AnnDatais actually interested in e.g., cell names, for verification.The coordinate of
anndata.experimental.backed.Dataset2D.index_dimMethods
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.