blosc2.NDArray.to_cframe#
- NDArray.to_cframe() bytes #
Get a bytes object containing the serialized NDArray instance.
- Returns:
out – The buffer containing the serialized NDArray instance.
- Return type:
bytes
See also
ndarray_from_cframe()
This function can be used to reconstruct a NDArray from the serialized bytes.
Examples
>>> import blosc2 >>> a = blosc2.full(shape=(1000, 1000), fill_value=9, dtype='i4') >>> # Get the bytes object containing the serialized instance >>> cframe_bytes = a.to_cframe() >>> blosc_array = blosc2.ndarray_from_cframe(cframe_bytes) >>> print("Shape of the NDArray:", blosc_array.shape) >>> print("Data type of the NDArray:", blosc_array.dtype) Shape of the NDArray: (1000, 1000) Data type of the NDArray: int32