[Numpy-discussion] mask array and add to list

Tim Cera tim@cerazone....
Thu Apr 12 08:41:56 CDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120412/0657b6a1/attachment.html 


More information about the NumPy-Discussion mailing list