calculate mean array python code example
Example 1: np.array average row
>>> a = np.array([[1, 2], [3, 4]])
>>> np.mean(a)
2.5
>>> np.mean(a, axis=0)
array([2., 3.])
>>> np.mean(a, axis=1)
array([1.5, 3.5])
Example 2: mean of a vector in python
>>> import numpy
>>> numbers = [3, 2, 8, 7]
>>> mean = numpy.mean(numbers)
>>> mean
5.0