[SciPy-user] mean of arrays...
Alan G Isaac
aisaac@american....
Thu Sep 6 09:09:27 CDT 2007
On Thu, 6 Sep 2007, Gary Pajer apparently wrote:
> Am I missing something here? doesn't numpy.mean() find
> the mean of all elements regardless of dimension?
Right. The only thing you are missing is:
where in the conversation was it specified that
the OP wanted a mean along an axis rather than
the mean of all elements. I missed it too, but
such seems to be the case.
Cheers,
Alan Isaac
>>> x
array([[[1, 1],
[2, 2]],
[[3, 3],
[4, 4]]])
>>> x.shape
(2, 2, 2)
>>> x.mean()
2.5
>>> x.mean(-1)
array([[ 1., 2.],
[ 3., 4.]])
More information about the SciPy-user
mailing list