blosc2.NDArray.tobytes#

NDArray.tobytes()#

Returns a buffer with the data contents.

Returns:

out – The buffer containing the data of the whole array.

Return type:

bytes

Examples

>>> import blosc2
>>> import numpy as np
>>> dtype = np.dtype("i4")
>>> shape = [23, 11]
>>> a = np.arange(0, int(np.prod(shape)), dtype=dtype).reshape(shape)
>>> # Create an array
>>> b = blosc2.asarray(a)
>>> b.tobytes() == bytes(a[...])
True