zeros
Return a SparseArray of given shape and type, filled with zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape |
int or tuple of ints
|
Shape of the new array, e.g., |
required |
dtype |
data - type
|
The desired data-type for the array, e.g., |
float
|
format |
str
|
A format string. |
'coo'
|
compressed_axes |
iterable
|
The axes to compress if returning a GCXS array. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
SparseArray
|
Array of zeros with the given shape and dtype. |
Examples:
>>> zeros(5).todense()
array([0., 0., 0., 0., 0.])
>>> zeros((2, 2), dtype=int).todense()
array([[0, 0],
[0, 0]])
Source code in sparse/numba_backend/_common.py
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | |