COO.nbytes

COO.nbytes

The number of bytes taken up by this object. Note that for small arrays, this may undercount the number of bytes due to the large constant overhead.

Returns

The approximate bytes of memory taken by this object.

Return type

int

See also

numpy.ndarray.nbytes

The equivalent Numpy property.

Examples

>>> data = np.arange(6, dtype=np.uint8)
>>> coords = np.random.randint(1000, size=(3, 6), dtype=np.uint16)
>>> s = COO(coords, data, shape=(1000, 1000, 1000))
>>> s.nbytes
42