full

sparse.full(shape, fill_value, dtype=None)[source]

Return a COO array 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) or 2.
  • 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.
Returns:

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

Return type:

COO

Examples

>>> full(5, 9).todense()  # doctest: +NORMALIZE_WHITESPACE
array([9, 9, 9, 9, 9])
>>> full((2, 2), 9, dtype=float).todense()  # doctest: +SKIP
array([[9., 9.],
       [9., 9.]])