What does "axis=0" do for 3D array?
Hi, in the last question of this exercise, we are asked to use the axis argument of the np.mean() function to find the mean for every column of the 3D array. I understand that to compute along every column of a 3D array, we must specify "axis=1".
However, I was trying out what I would get if I specified "axis=0", and I was trying to make sense of the output, but I couldn't quite figure out what the function is doing. I thought specifying "axis=0" for np.mean() would compute the mean of each subarray (since this is the additional dimension for a 3D array, whereas 2D arrays only have rows and columns as their two dimensions), but this doesn't seem to be the case. Please see below for the code and corresponding output.
print(array_3D)
[[[ 1. 2. 3. 4. 5.]
[11. 21. 31. 41. 51.]]
[[11. 12. 13. 14. 15.]
[51. 52. 53. 54. 5.]]]
print(np.mean(array_3D, axis=0))
[[ 6. 7. 8. 9. 10. ]
[31. 36.5 42. 47.5 28. ]]
Any explanation of what "axis=0" in the np.mean() function is computing would be so appreciated, thank you!