[Numpy-discussion] Unexpected behaviour by in place addition of array and masked array

Pierre GM pgmdevlist at gmail.com
Thu Apr 24 09:55:18 EDT 2008


Hanno,

On Thursday 24 April 2008 05:35:41 Hanno Klemm wrote:
> >>> N.__version__
> '1.0.4'

OK, you're using the "old" version of masked array.

> I tried adding a masked array and a usual array in place and got back
> the usual array. Is this expected behaviour? I would have expected to
> get a masked array back.

Yes, it is expected: as you're adding in place, you can't change the nature of 
the array, so a ndarray will stay a ndarray. Following the same line, adding 
a float array in place to a int array will give you a int array.



More information about the NumPy-Discussion mailing list