[Numpy-discussion] mask array and add to list

questions anon questions.anon@gmail....
Wed Apr 18 17:34:56 CDT 2012


excellent thank you, that worked perfectly. I just need to remember this
feature next time I need it.
Thanks again

On Thu, Apr 12, 2012 at 11:41 PM, Tim Cera <tim@cerazone.net> wrote:

> Use 'ma.max' instead of 'np.max'.  This might be a bug OR an undocumented
> feature.  :-)
>
>     import numpy.ma as ma
>     marr = ma.array(range(10), mask=[0,0,0,0,0,1,1,1,1,1])
>     np.max(marr)
>     4                      # mask is used
>
>     a = []
>     a.append(marr)
>     a.append(marr)
>     np.max(a)
>     9                      # mask is not used
>
>     ma.max(a)
>     4                      # mask is used
>
> Kindest regards,
> Tim
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120419/6095b380/attachment.html 


More information about the NumPy-Discussion mailing list