<p dir="auto">Related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="7728255" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/1578" data-hovercard-type="issue" data-hovercard-url="/numpy/numpy/issues/1578/hovercard" href="https://github.com/numpy/numpy/issues/1578">#1578</a>, nan's are still converted to -maxint when it is assigned by slicing.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.__version__
'1.9.0.dev-6857173'
&gt;&gt;&gt; i = np.array([1, 2, 3, 4, 5])
&gt;&gt;&gt; i[3] = np.nan
ValueError: cannot convert float NaN to integer
&gt;&gt;&gt; i[0:2] = np.nan
array([-9223372036854775808, -9223372036854775808,                    3,
                          4,                    5])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; np.__version__
'1.9.0.dev-6857173'
&gt;&gt;&gt; i = np.array([1, 2, 3, 4, 5])
&gt;&gt;&gt; i[3] = np.nan
ValueError: cannot convert float NaN to integer
&gt;&gt;&gt; i[0:2] = np.nan
array([-9223372036854775808, -9223372036854775808,                    3,
                          4,                    5])
</code></pre></div>
<p dir="auto">This seems inconsistent:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [38]: x = np.array([np.nan, 1, 2, 3])

In [39]: x
Out[39]: array([ nan,   1.,   2.,   3.])

In [40]: x.astype(np.int16)
Out[40]: array([0, 1, 2, 3], dtype=int16)

In [41]: x.astype(np.int32)
Out[41]: array([-2147483648,           1,           2,           3], dtype=int32)

In [42]: x.astype(np.int64)
Out[42]:
array([-9223372036854775808,                    1,                    2,
                          3])"><pre class="notranslate"><code class="notranslate">In [38]: x = np.array([np.nan, 1, 2, 3])

In [39]: x
Out[39]: array([ nan,   1.,   2.,   3.])

In [40]: x.astype(np.int16)
Out[40]: array([0, 1, 2, 3], dtype=int16)

In [41]: x.astype(np.int32)
Out[41]: array([-2147483648,           1,           2,           3], dtype=int32)

In [42]: x.astype(np.int64)
Out[42]:
array([-9223372036854775808,                    1,                    2,
                          3])
</code></pre></div>