You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x = np.array([([0, 0], 0.0), ([2, 2], 3.0)],
dtype=[('field1', 'i4', (2,)), ('field2', 'f4')])
y = x.view(np.ma.MaskedArray)
y['field1'].set_fill_value(5)
Produces,
File "...\numpy\ma\core.py", line 3615, in set_fill_value
_fill_value[()] = target
TypeError: 'numpy.int32' object does not support item assignment
The reason is that np.ma.MaskedArray._fill_value should be a zero-length array, containing the fill value. However the fix in that issue simply sets it to be a value (e.g. one with dtype numpy.int32), not a zero-length array.
The text was updated successfully, but these errors were encountered:
Nice catch! You mean zero-dimensional array though.
A simple fix would be to change this line to dout._fill_value = dout._fill_value.ravel()[0,...]. It's unfortunately slower to use ravel than flat, but that's a corner case anyway.
Uh oh!
There was an error while loading. Please reload this page.
A bug was introduced in fix for #6723,
Produces,
The reason is that
np.ma.MaskedArray._fill_value
should be a zero-length array, containing the fill value. However the fix in that issue simply sets it to be a value (e.g. one with dtype numpy.int32), not a zero-length array.The text was updated successfully, but these errors were encountered: