[Numpy-discussion] surprising behavior of np.asarray on masked arrays

Faraz Mirzaei fmmirzaei at gmail.com
Thu Dec 5 22:14:01 EST 2013


Hi,

If I pass a masked array through np.asarray, I get original unmasked array.

Example:

test = np.array([[1, 0], [-1, 3]])

testMasked = ma.masked_less_equal(test, 0)


print testMasked

[[1 --]

 [-- 3]]


print testMasked.fill_value

999999


print np.asarray(testMasked)

[[ 1 0]

 [-1 3]]


Is this behavior intentional? How does the np.asarray access the original
masked values? Shouldn't the masked values be at least filled with
fill_value?


Thanks,


Faraz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131205/cf9143d9/attachment.html>


More information about the NumPy-Discussion mailing list