ehrapy.anndata.replace_feature_types

ehrapy.anndata.replace_feature_types(adata, features, corrected_type)[source]

Correct the feature types for a list of features inplace.

Parameters:
  • adataAnnData object storing the EHR data.

  • features (Iterable[str]) – The features to correct.

  • corrected_type (str) – The corrected feature type. One of ‘date’, ‘categorical’, or ‘numeric’.

Examples

>>> import ehrapy as ep
>>> adata = ep.dt.diabetes_130_fairlearn()
>>> ep.ad.infer_feature_types(adata)
>>> ep.ad.replace_feature_types(adata, ["time_in_hospital", "number_diagnoses", "num_procedures"], "numeric")