-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Description
....where "unexpected" means I didn't expect it. This may just be a documentation fix, or maybe I will be scolded for not realizing how np.ma works, but I don't think this behavior is appropriate:
In [100]: x = np.ma.ones(5)
In [101]: x.mask = [False,False,True,False,False]
In [102]: np.copy(x)
Out[102]: array([ 1., 1., 1., 1., 1.])
In [103]: np.ma.copy(x)
Out[103]:
masked_array(data = [1.0 1.0 -- 1.0 1.0],
mask = [False False True False False],
fill_value = 1e+20)
In [104]: np.__version__
Out[104]: '1.8.0.dev-074a40c'
I would at least expect a warning, but would prefer to see, in order of preference:
np.copy(x)returns a masked array (since x is a masked array)np.copy(x)warns that it is unmasking the array, then returns the same array as abovenp.copy(x)raises an exceptionnp.copy(x)returns[1,1,nan,1,1](this is probably not ideal)
Reactions are currently unavailable