[SciPy-user] amax, amin, mean

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Wed Mar 29 04:15:58 CST 2006


Hi,
Effectively, I had an old Numeric package installed, and debian provides scipy 
using numeric. Now I have:
#####################################
lionel[données]21>from scipy import *

lionel[données]22>from numpy import ma as MA

lionel[données]23>test=MA.masked_object([1,2,3,4,nan,6], nan)

lionel[données]24>print amin(test), amax(test), mean(test)
1.0 6.0 nan

lionel[données]25>test=MA.masked_values([1,2,3,4,1.e-20,6], 1.e-20)

lionel[données]26>print amin(test), amax(test), mean(test)
1.0 6.0 3.2
#####################################
seems mean function doesn't like nan object. I know it's not the best way 
using NaN, but in a text file it's cleariest to use it.
Thanks for your help

PS: newbie in scipy, I search a function in scipy similar to the "factor" and 
"tapply" functions used in R. Are they exist?

Le Mercredi 29 Mars 2006 11:03, Johannes Löhnert a écrit :
> Hi,
>
> > [...]
> > /usr/lib/python2.4/site-packages/Numeric/MA/MA.py in __array__(self, t)
>
> it looks as if you installed the 'old' Numeric module. The current scipy
> (0.4.8 iirc) needs numpy, which one could call Numeric's successor. You
> won't need Numeric at all.
>
> Johannes

-- 
Lionel Roubeyrie - lroubeyrie at limair.asso.fr
LIMAIR
http://www.limair.asso.fr



More information about the SciPy-user mailing list