Skip to main content
`Ctrl`+`K`
scipy.sparse.dok_matrix.

# mean

dok_matrix.mean(axis=None, dtype=None, out=None)

  Compute the arithmetic mean along the specified axis.

  Returns the average of the array/matrix elements. The average is taken over all elements in the array/matrix by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.

  Parameters:
    axis{-2, -1, 0, 1, None} optional

      Axis along which the mean is computed. The default is to compute the mean of all elements in the array/matrix (i.e., axis = None).

    dtype data-type, optional

      Type to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.

      Added in version 0.18.0.

    out np.matrix, optional

      Alternative output matrix in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary.

      Added in version 0.18.0.

  Returns:
    m np.matrix

      Mean along the specified axis.

  See also

  `numpy.matrix.mean`

    NumPy’s implementation of ‘mean’ for matrices