mean matrix python numpy code example
Example 1: numpy mean
>> import numpy as np
>> a=[1,2,3,4,5]
>> np.mean(a)
3.0
Example 2: python mean ndarray
# define ndarray a
a = np.array([[1, 2], [3, 4]])
# get the mean
np.mean(a, axis=None)
>> import numpy as np
>> a=[1,2,3,4,5]
>> np.mean(a)
3.0
# define ndarray a
a = np.array([[1, 2], [3, 4]])
# get the mean
np.mean(a, axis=None)