ehrapy.data.mimic_3_demo

ehrapy.data.mimic_3_demo(encoded=False, anndata=False, columns_obs_only=None)[source]

Loads the MIMIC-III demo dataset as a dictionary of Pandas DataFrames.

The MIMIC-III dataset comes in the form of 26 CSV tables. Although, it is possible to return one AnnData object per csv table, it might be easier to start with Pandas DataFrames to aggregate the desired measurements with Pandas SQL. https://github.com/yhat/pandasql/ might be useful. The resulting DataFrame can then be transformed into an AnnData object with df_to_anndata().

Parameters:
  • encoded (bool) – Whether to return an already encoded object.

  • anndata (bool) – Whether to return one AnnData object per CSV file. Defaults to False

  • columns_obs_only (dict[str, list[str]] | list[str] | None) – Columns to include in obs only and not X.

Return type:

dict[str, AnnData] | dict[str, DataFrame]

Returns:

A dictionary of AnnData objects or a dictionary of Pandas DataFrames

Examples

>>> import ehrapy as ep
>>> dfs = ep.dt.mimic_3_demo()