1>>> a = np.array([[1, 2], [3, 4]])
2>>> np.mean(a)
32.5
4>>> np.mean(a, axis=0)
5array([2., 3.])
6>>> np.mean(a, axis=1)
7array([1.5, 3.5])
8
1>>> import numpy
2>>> numbers = [3, 2, 8, 7]
3>>> mean = numpy.mean(numbers)
4>>> mean
55.0
1# define ndarray a
2a = np.array([[1, 2], [3, 4]])
3# get the mean
4np.mean(a, axis=None)