ehrapy.anndata.move_to_x

ehrapy.anndata.move_to_x(adata, to_x)[source]

Move features from obs to X inplace.

Parameters:
  • adata (AnnData) – The AnnData object

  • to_x (list[str] | str) – The columns to move to X

  • copy – Whether to return a copy or not

Return type:

AnnData

Returns:

A new AnnData object with moved columns from obs to X. This should not be used for datetime columns currently.

Examples

>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> ep.ad.move_to_obs(adata, ["age"], copy_obs=False)
>>> new_adata = ep.ad.move_to_x(adata, ["age"])