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
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 |
|