-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Closed
Labels
33 - QuestionQuestion about NumPy usage or developmentQuestion about NumPy usage or development
Description
When a np.array (say a) is added with np.ma.masked_array (say ma) using a += ma operator, it gives a np.array output while a = a + ma gives a np.ma.maked_array output.
Reproducing code example:
>>> import numpy as np
>>> A = np.arange(10)
>>> ma = np.ma.masked_array(A, A>4)
>>> ma
masked_array(data=[0, 1, 2, 3, 4, --, --, --, --, --],
mask=[False, False, False, False, False, True, True, True,
True, True],
fill_value=999999)
>>> A += ma
>>> A
array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18])
>>> A = A + ma
>>> A
masked_array(data=[0, 4, 8, 12, 16, --, --, --, --, --],
mask=[False, False, False, False, False, True, True, True,
True, True],
fill_value=999999)
>>>import numpy as np
<< your code here >>Error message:
Numpy/Python version information:
>>> np.__version__
'1.18.4'Metadata
Metadata
Assignees
Labels
33 - QuestionQuestion about NumPy usage or developmentQuestion about NumPy usage or development