full¶
-
sparse.
full
(shape, fill_value, dtype=None, format='coo', compressed_axes=None)[source]¶ Return a SparseArray of given shape and type, filled with fill_value.
- Parameters
shape (int or tuple of ints) – Shape of the new array, e.g.,
(2, 3)
or2
.fill_value (scalar) – Fill value.
dtype (data-type, optional) – The desired data-type for the array. The default, None, means np.array(fill_value).dtype.
format (str, optional) – A format string.
compressed_axes (iterable, optional) – The axes to compress if returning a GCXS array.
- Returns
out – Array of fill_value with the given shape and dtype.
- Return type
Examples
>>> full(5, 9).todense() array([9, 9, 9, 9, 9])
>>> full((2, 2), 9, dtype=float).todense() array([[9., 9.], [9., 9.]])