title: Set values in numpy array to NaN by index
body: <p>I want to set specific values in a numpy array to <code>NaN</code> (to exclude them from a row-wise mean calculation).</p>
  
  <p>I tried</p>
  
  <pre><code>import numpy
  
  x = numpy.array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0]])
  cutoff = [5, 7]
  for i in range(len(x)):
      x[i][0:cutoff[i]:1] = numpy.nan
  </code></pre>
  
  <p>Looking at <code>x</code>, I only see <code>-9223372036854775808</code> where I expect <code>NaN</code>.</p>
  
  <p>I thought about an alternative:</p>
  
  <pre><code>for i in range(len(x)):
      for k in range(cutoff[i]):
          x[i][k] = numpy.nan
  </code></pre>
  
  <p>Nothing happens. What am I doing wrong?</p>