ehrapy.io.write#

ehrapy.io.write(filename, adata, extension=None, compression='gzip', compression_opts=None)[source]#

Write AnnData objects to file. It is possbile to either write an AnnData object to a .csv file or a .h5ad file. The .h5ad file can be used as a cache to save the current state of the object and to retrieve it faster once needed. This preserves the object state at the time of writing. It is possible to write both, encoded and unencoded objects.

Parameters:
Return type:

None

Examples

>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> ep.io.write("mimic_2.h5ad", adata)