ehrdata.io.write_h5ed#
- ehrdata.io.write_h5ed(edata, filename, *, compression=None, compression_opts=None)#
Write
EHRDataobjects to an ehrdata hdf5 file (.h5ed)..h5edis the ehrdata on-disk format. To write the file,Xandlayerscannot be written asobjectdtype. If any of these fields is ofobjectdtype, this function will attempt to cast it to a numeric dtype; if this fails, the field will be casted to a string dtype.- Parameters:
- edata
EHRData Central data object.
- filename
str|Path Name of the output file, can also be prefixed with relative or absolute path to save the file to.
- compression
Literal['gzip','lzf'] |None(default:None) Optional file compression. Setting compression to ‘gzip’ can save disk space but will slow down writing and subsequent reading.
- compression_opts
int|None(default:None) For [
lzf,gzip], see the h5py Filter pipeline.
- edata
- Return type:
Examples
>>> import ehrdata as ed >>> edata = ed.dt.mimic_2() >>> ed.io.write_h5ed(edata, "mimic_2.h5ed")