Posted on:

11 Oct 2022

0

Can't figure out the output of the mean value with axis

Hi everyone,

As title, I can't figure out the output of the following mean value of the array_a:

array_a = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]])

np.mean(array_a, axis = 0)
np.mean(array_a, axis = 1)

the output would be

array([[4., 5., 6.],
       [7., 8., 9.]])

and

array([[ 2.5,  3.5,  4.5],
       [ 8.5,  9.5, 10.5]])

accordingly.

I may need someone's help of the explaination in this self-made question.

Thank you!

0 answers ( 0 marked as helpful)

Submit an answer