[SciPy-user] mean of arrays...

Gary Pajer gary.pajer@gmail....
Thu Sep 6 08:34:17 CDT 2007


On 9/6/07, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
> On Thu, Sep 06, 2007 at 02:33:35PM +0200, fred wrote:
> > Gael Varoquaux a écrit :
> > > On Thu, Sep 06, 2007 at 12:07:21PM +0200, fred wrote:
>
> > >> I want to compute the element wise mean of 2D or 3D arrays (~100).
>
>
> > > Stack all these n-arrays along an n+1 dimension, and use the numpy.mean
> > > function, specifying the axis as n+1.

[...]

> listmean = lambda l: concatenate([a[..., newaxis] for a in l],
>                                                 axis=-1).mean(axis=-1)
>
> :->.
>
> Gaël

Am I missing something here?
doesn't numpy.mean() find the mean of all elements regardless of dimension?

-gary


More information about the SciPy-user mailing list