-2
Hello, I have the following matrix:
matriz = np.array([
[5, 5, 5],
[5, 5, 5],
[10, 10, 10]
])
and accurate the result with an array of their respective medias, thus:
[6.66, 6.66, 6.66]
Grateful
-2
Hello, I have the following matrix:
matriz = np.array([
[5, 5, 5],
[5, 5, 5],
[10, 10, 10]
])
and accurate the result with an array of their respective medias, thus:
[6.66, 6.66, 6.66]
Grateful
4
Using the function numpy.average
you can average the values of a array
for a given axle.
Ex:
matriz = np.array([
[5, 5, 5],
[5, 5, 5],
[10, 10, 10]
])
#media para o eixo Y
media = np.average(matriz, axis=0)
Variable output media
:
[6.66666667 6.66666667 6.66666667]
In the documentation you can see better about the parameters.
Browser other questions tagged python numpy
You are not signed in. Login or sign up in order to post.
What you’ve already done? ;)
– Tuxpilgrim
For now just searching the numpy documentation, I would like to resolve this situation with just a numpy function.
– Lucas Caresia
numpy.average
andnumpy.mean
help? Seems to be what you seek– Tuxpilgrim