zeros¶
-
sparse.
zeros
(shape, dtype=<class 'float'>, format='coo', compressed_axes=None)[source]¶ Return a SparseArray of given shape and type, filled with zeros.
- Parameters
shape (int or tuple of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.dtype (data-type, optional) – The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.
format (str, optional) – A format string.
compressed_axes (iterable, optional) – The axes to compress if returning a GCXS array.
- Returns
out – Array of zeros with the given shape and dtype.
- Return type
Examples
>>> zeros(5).todense() array([0., 0., 0., 0., 0.])
>>> zeros((2, 2), dtype=int).todense() array([[0, 0], [0, 0]])