zeros

sparse.zeros(shape, dtype=<class 'float'>)[source]

Return a COO array of given shape and type, filled with zeros.

Parameters
  • shape (int or tuple of ints) – Shape of the new array, e.g., (2, 3) or 2.

  • dtype (data-type, optional) – The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.

Returns

out – Array of zeros with the given shape and dtype.

Return type

COO

Examples

>>> zeros(5).todense()  
array([0., 0., 0., 0., 0.])
>>> zeros((2, 2), dtype=int).todense()  
array([[0, 0],
       [0, 0]])