[Numpy-discussion] take not respecting masked arrays?

Pierre GM pgmdevlist@gmail....
Sun Feb 28 22:01:16 CST 2010

On Feb 28, 2010, at 8:59 PM, Peter Shinners wrote:
> I have a 2D masked array that has indices into a 1D array. I want to use 
> some form of "take" to fetch the values into the 2D array. I've tried 
> both numpy.take and numpy.ma.take, but they both return a new unmasked 
> array.

Mmh. Surprising.  np.ma.take should return a masked array if it's given a masked array as input. Can you pastebin the array that gives you trouble ? I need to investigate that.
As a temporary workaround, use np.take on first the _data, then the _mask and construct a new masked array from the two results.

More information about the NumPy-Discussion mailing list