title: How can I change the value of a masked array in numpy?
body: <p>In my code, at some point I try to modify a value of a masked array, yet python seems to ignore this. I'm thinking this has to do with the way memory is stored in arrays, as if I were modifying a copy of the value and not the value itself, but I'm not well versed enough in this to have any clue how to resolve it.</p>
  
  <p>Here is a simplified version of what I'm trying to do : </p>
  
  <pre><code>    x = np.zeros((2,5)) # create 2D array of zeroes
      x[0][1:3] = 5       # replace some values along 1st dimension with 5
  
      mask = (x[0] &gt; 0)   # create a mask to only deal with the non negative values
  
      x[0][mask][1] = 10  # change one of the values that is non negative 
  
      print x[0][mask][1] # value isn't changed in the original array
  </code></pre>
  
  <p>the output of this is :</p>
  
  <pre><code>    5.0
  </code></pre>
  
  <p>when it should be 10.</p>
  
  <p>Any help would be greatly appreciated, ideally this need to be scalable (meaning I don't necessarily know the shape of x, or where the values are non-negative, or which one I will need to modify).</p>
  
  <p>I'm working with numpy 1.11.0, on python 2.7.12 on Ubuntu 16.04.2</p>
  
  <p>Thanks !</p>