ehrapy.preprocessing.minmax_norm(adata, vars=None, copy=False, **kwargs)[source]#

Apply min-max normalization.

Functionality is provided by minmax_scale(), see for details.

  • adata (AnnData) – AnnData object containing X to normalize values in. Must already be encoded using encode().

  • vars (str | Sequence[str] | None) – List of the names of the numeric variables to normalize. If None all numeric variables will be normalized. Defaults to False .

  • copy (bool) – Whether to return a copy or act in place. Defaults to False .

  • **kwargs – Additional arguments passed to minmax_scale()

Return type:

AnnData | None


AnnData object with normalized X. Also stores a record of applied normalizations as a dictionary in adata.uns[“normalization”].


>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> adata_norm = ep.pp.minmax_norm(adata, copy=True)