ehrapy.anndata.get_rank_features_df(adata, group, *, key='rank_features_groups', pval_cutoff=None, log2fc_min=None, log2fc_max=None, features=None)[source]# results in the form of a DataFrame.

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

  • group (str | Iterable[str]) – Which group (as in’s groupby argument) to return results from. Can be a list. All groups are returned if groups is None.

  • key (str) – Key differential groups were stored under.

  • pval_cutoff (float | None) – Return only adjusted p-values below the cutoff.

  • log2fc_min (float | None) – Minimum logfc to return.

  • log2fc_max (float | None) – Maximum logfc to return.

  • features (str | None) – Column name in .var DataFrame that stores gene symbols. Specifying this will add that column to the returned DataFrame.


A Pandas DataFrame of all rank genes groups results.


>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>>, "service_unit")
>>> df =, group="FICU")