ehrapy.anndata.get_var_df

ehrapy.anndata.get_var_df(adata, keys=(), varm_keys=(), *, layer=None)[source]

Return values for observations in adata.

Parameters:
  • adata (AnnData) – AnnData object to get values from.

  • keys (Iterable[str], default: ()) – Keys from either .obs_names, or .var.columns.

  • varm_keys (Iterable[tuple[str, int]], default: ()) – Tuple of (key from varm, column index of varm[key]).

  • layer (str, default: None) – Layer of adata.

Returns:

A dataframe with adata.var_names as index, and values specified by keys and varm_keys.

Examples

>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> four_patients = ep.ad.get_var_df(adata, keys=["0", "1", "2", "3"])