nimble.zeros

nimble.zeros(numPoints, numFeatures, pointNames='automatic', featureNames='automatic', returnType='Matrix', name=None)

Return a data object of the given shape containing all 0 values.

Parameters:
  • numPoints (int) – The number of points in the returned object.

  • numFeatures (int) – The number of features in the returned object.

  • pointNames ('automatic', list, dict) – Names to be associated with the points in the returned object. If ‘automatic’, default names will be generated. Otherwise, may be specified explictly by some list-like or dict-like object, so long as all points in the data are assigned a name and the names for each point are unique.

  • featureNames ('automatic', list, dict) – Names to be associated with the features in the returned object. If ‘automatic’, default names will be generated. Otherwise, may be specified explictly by some list-like or dict-like object, so long as all features in the data are assigned a name and the names for each feature are unique.

  • returnType (str) – May be any of the allowed types specified in nimble.core.data.available. Default is “Matrix”.

  • name (str, None) – A string describing the data that will display when printing or logging the returned object. This value is also set as the name attribute of the returned object.

Returns:

nimble.core.data.Base – Subclass of Base object corresponding with the returnType.

See also

ones, identity

Examples

Zeros with default names.

>>> zeros = nimble.zeros(5, 5)
>>> zeros
<Matrix 5pt x 5ft
     0  1  2  3  4
   ┌──────────────
 0 │ 0  0  0  0  0
 1 │ 0  0  0  0  0
 2 │ 0  0  0  0  0
 3 │ 0  0  0  0  0
 4 │ 0  0  0  0  0
>

Named object of zeros with pointNames and featureNames.

>>> zerosSparse = nimble.zeros(4, 4, returnType="Sparse",
...                            pointNames=['1', '2', '3', '4'],
...                            featureNames=['a', 'b', 'c', 'd'],
...                            name='Sparse all-zeros')
>>> zerosSparse
<Sparse "Sparse all-zeros" 4pt x 4ft
     a  b  c  d
   ┌───────────
 1 │ 0  0  0  0
 2 │ 0  0  0  0
 3 │ 0  0  0  0
 4 │ 0  0  0  0
>

Keywords: matrix, sparse, 0, 0s