blosc2.NDArray.tobytes#

NDArray.tobytes() bytes#

Returns a buffer containing the data of the entire array.

Returns:

out – The buffer with 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