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])
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])
numpy mean
>> import numpy as np
>> a=[1,2,3,4,5]
>> np.mean(a)
3.0
mean of a vector in python
>>> import numpy
>>> numbers = [3, 2, 8, 7]
>>> mean = numpy.mean(numbers)
>>> mean
5.0
numpy average
import numpy as np
a = np.arange(6).reshape(3,2)
average = np.average(a)
python mean ndarray
# define ndarray a
a = np.array([[1, 2], [3, 4]])
# get the mean
np.mean(a, axis=None)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us