<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/2004" rel="nofollow">http://projects.scipy.org/numpy/ticket/2004</a> on 2011-12-23 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/charris/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/charris">@charris</a>, assigned to unknown.</em></p>
<p dir="auto">To wit:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [13]: x = ones(5, maskna=1)

In [14]: x[2] = NA

In [15]: x.astype(double)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/charris/&lt;ipython-input-15-c95438174230&gt; in &lt;module&gt;()
----&gt; 1 x.astype(double)

ValueError: Cannot assign NA to an array which does not support NAs"><pre class="notranslate"><code class="notranslate">In [13]: x = ones(5, maskna=1)

In [14]: x[2] = NA

In [15]: x.astype(double)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/charris/&lt;ipython-input-15-c95438174230&gt; in &lt;module&gt;()
----&gt; 1 x.astype(double)

ValueError: Cannot assign NA to an array which does not support NAs
</code></pre></div>
<p dir="auto">I suspect the easiest thing to do here is propagate the MASKNA flag.</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1973" rel="nofollow">http://projects.scipy.org/numpy/ticket/1973</a> on 2011-11-04 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bsouthey/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/bsouthey">@bsouthey</a>, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pierregm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pierregm">@pierregm</a>.</em></p>
<p dir="auto">I get an error when displaying a masked array that contains the new missing value, np.NA under 64-bit Linux. But the operations seem to work as expected.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; np.__version__
'2.0.0.dev-7297785'
&gt;&gt;&gt; b=np.ma.array([3,5,np.NA,6], mask=[0,0,1,0])
&gt;&gt;&gt; b
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/lib64/python2.7/site-packages/numpy/ma/core.py&quot;, line 3551, in __repr__
    data=str(self), mask=str(self._mask),
  File &quot;/usr/lib64/python2.7/site-packages/numpy/ma/core.py&quot;, line 3534, in __str__
    res = self._data.astype(&quot;O&quot;)
ValueError: Cannot assign NA to an array which does not support NAs
&gt;&gt;&gt; b._data
array([3, 5, NA, 6])
&gt;&gt;&gt; b.sum()
14
&gt;&gt;&gt; b.mask=[0,0,0,0]
&gt;&gt;&gt; b
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/lib64/python2.7/site-packages/numpy/ma/core.py&quot;, line 3551, in __repr__
    data=str(self), mask=str(self._mask),
  File &quot;/usr/lib64/python2.7/site-packages/numpy/ma/core.py&quot;, line 3534, in __str__
    res = self._data.astype(&quot;O&quot;)
ValueError: Cannot assign NA to an array which does not support NAs
&gt;&gt;&gt; b.sum()
NA(dtype='int64')"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; np.__version__
'2.0.0.dev-7297785'
&gt;&gt;&gt; b=np.ma.array([3,5,np.NA,6], mask=[0,0,1,0])
&gt;&gt;&gt; b
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3551, in __repr__
    data=str(self), mask=str(self._mask),
  File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3534, in __str__
    res = self._data.astype("O")
ValueError: Cannot assign NA to an array which does not support NAs
&gt;&gt;&gt; b._data
array([3, 5, NA, 6])
&gt;&gt;&gt; b.sum()
14
&gt;&gt;&gt; b.mask=[0,0,0,0]
&gt;&gt;&gt; b
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3551, in __repr__
    data=str(self), mask=str(self._mask),
  File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3534, in __str__
    res = self._data.astype("O")
ValueError: Cannot assign NA to an array which does not support NAs
&gt;&gt;&gt; b.sum()
NA(dtype='int64')
</code></pre></div>