ehrdata.io.read_zarr#
- ehrdata.io.read_zarr(filename, *, harmonize_missing_values=True, cast_variables_to_float=True)#
Read a zarr store into an
EHRDataobject.Can also read
AnnDataZarr stores. In this case, a default.temfield is created in theehrdata object.- Parameters:
- filename
The filename, or a Zarr storage class.
- harmonize_missing_values default:
True Whether to call
ehrdata.harmonize_missing_valueson all detected layers.- cast_variables_to_float default:
True For non-numeric arrays, try to cast the values for each variable to dtype
np.float64. If the cast fails for the values of one variable, then the values of these variable remain unaltered. This can be helpful to recover arrays that were of dtypeobjectwhen they were written to disk.
Examples
>>> import ehrdata as ed >>> edata = ed.dt.mimic_2() >>> ed.io.write_zarr("mimic_2.zarr", edata) >>> edata_from_zarr = ed.io.read_zarr("mimic_2.zarr")