Compute the arithmetic mean along the specified axis.
Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
Parameters: | a : array_like
axis : int, optional
dtype : dtype, optional
out : ndarray, optional
|
---|---|
Returns: | mean : ndarray, see dtype parameter above
|
See also
Notes
The arithmetic mean is the sum of the elements along the axis divided by the number of elements.
Examples
>>> a = np.array([[1,2],[3,4]])
>>> np.mean(a)
2.5
>>> np.mean(a,0)
array([ 2., 3.])
>>> np.mean(a,1)
array([ 1.5, 3.5])