[SciPy-user] mean of arrays...
fred
fredmfp@gmail....
Thu Sep 6 08:56:21 CDT 2007
Gael Varoquaux a écrit :
> On Thu, Sep 06, 2007 at 09:34:17AM -0400, Gary Pajer wrote:
>
>>> listmean = lambda l: concatenate([a[..., newaxis] for a in l],
>>> axis=-1).mean(axis=-1)
>>>
>
>
>> Am I missing something here?
>> doesn't numpy.mean() find the mean of all elements regardless of dimension?
>>
>
> That's what the "axis=-1" is for.
>
> Did I make an error ? This should be working, I tested it.
>
As my arrays are set in a list (data), here's my solution:
data_mean = array(data).transpose().mean(axis=-1).transpose()
Thanks to all.
Cheers,
--
http://scipy.org/FredericPetit
More information about the SciPy-user
mailing list