pg_utils.numerics.io.serialize_coo
- pg_utils.numerics.io.serialize_coo(sp_array: Union[coo_array, coo_matrix], transform: Optional[Callable[[ndarray], ndarray]] = None, format: Literal['json', 'pickle'] = 'pickle') dict [source]
Retrieve serializable objs of COOrdinate format sparse array
- Parameters:
sp_array (scipy.sparse.coo_array) – sparse array to serialize
transform (Optional[Callable[[np.ndarray], np.ndarray]]) – transform the sparse data elements. Default is None, no transformation
format (Literal["json", "pickle"]) – serialization format; if pickle, the objects will be left as it is; if json, the numpy arrays will be unparsed into lists, and data are preferrably converted to string using transform
- Returns:
serialized object