2008/5/20 Vasileios Gkinis <[EMAIL PROTECTED]>:

> I have a question concerning nan in NumPy.
> Lets say i have an array of sample measurements
> a = array((2,4,nan))
> in NumPy calculating the mean of the elements in array a looks like:
>
>>>> a = array((2,4,nan))
>>>> a
> array([  2.,   4.,  NaN])
>>>> mean(a)
> nan
>
> What if i simply dont want nan to propagate and get something that would
> look like:
>
>>>> a = array((2,4,nan))
>>>> a
> array([  2.,   4.,  NaN])
>>>> mean(a)
> 3.

For more elaborate handling of missing data, look into "masked
arrays", in numpy.ma. They are designed to deal with exactly this sort
of thing.

Anne
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to