ehrdata.io.write_zarr#
- ehrdata.io.write_zarr(edata, filename, *, chunks='auto', convert_strings_to_categoricals=True)#
Write
EHRDataobjects to disk.To write to a
.zarrfile,X, andlayerscannot be written asobjectdtype. If any of these fields is ofobjectdtype, it this function will attempt to cast it to a numeric dtype; if this fails, the field will be casted to astrdtype.- 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.
- chunks Literal[‘auto’ | ‘ehrdata_auto’] (default:
'auto') Specify strategy of how data should be chunked. For simplicity, currently only 2 options are available:
"auto"will write the data withwrite_elem()’s default settings."ehrdata_auto"will write the data chunked (and sharded) based on a heuristic that loosely speaking writes slightly smaller chunks.- convert_strings_to_categoricals bool (default:
True) Convert columns of
strdtype in.obsand.varand.temtocategoricaldtype.
- Return type:
None
Examples
>>> import ehrdata as ed >>> edata = ed.dt.mimic_2() >>> ed.io.write_zarr("mimic_2.zarr", edata)