[SciPy-user] mean of arrays...
Gael Varoquaux
gael.varoquaux@normalesup....
Thu Sep 6 07:47:06 CDT 2007
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.
> I can get it working by hand, if dimension is fixed, no problem.
> But how can I do this for a n+1 dimension array ?:
> - create the array;
> - fill the array.
> I have one solution: test if my arrays are 2D or 3D.
> If this is the only one solution, I get it,
> but I would like to have a solution for whatever dimension
> my arrays have.
listmean = lambda l: concatenate([a[..., newaxis] for a in l],
axis=-1).mean(axis=-1)
:->.
Gaël
More information about the SciPy-user
mailing list