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
When setting an element of an unmasked array to ma.masked, the error message is ValueError: setting an array element with a sequence.. This error message is confusing or outright wrong. The same error message happens in other contexts, for example, if warning are turned to errors then UserWarning: converting masked element to nan becomes the same error message.
In [301]: A = arange(5)
In [303]: A[0] = ma.masked
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-303-286b16dc7aa0> in <module>()
----> 1 A[0] = ma.masked
ValueError: setting an array element with a sequence.
The text was updated successfully, but these errors were encountered:
This is super weird. Ultimately, the problem is that ->f->setitem on numeric types does not know how to handle 0d arrays. The bug doesn't exist for string types, because that setitem handler does know how to deal with it (as of #8903).
It's not clear to me how we end up calling setitem here at all - there's something special going on with masked that I can't reproduce with a plain 0d array
>>> a = np.zeros(2)
>>> a[0] = np.ma.masked
ValueError: setting an array element with a sequence.
>>> b = np.zeros((2, 2))
>>> b[0] = np.ma.masked
UserWarning: Warning: converting a masked element to nan.
When setting an element of an unmasked array to
ma.masked
, the error message isValueError: setting an array element with a sequence.
. This error message is confusing or outright wrong. The same error message happens in other contexts, for example, if warning are turned to errors thenUserWarning: converting masked element to nan
becomes the same error message.The text was updated successfully, but these errors were encountered: