title: how to modify a 2D numpy array at specific locations without a loop?
body: <p>I have a 2D numpy array and I have a arrays of rows and columns which should be set to a particular value. Lets consider the following example</p>
  
  <pre><code> a = array([[1, 2, 3],
              [4, 5, 6],
              [7, 8, 9]])
  </code></pre>
  
  <p>I want to modify entries at rows [0,2] and columns [1,2]. This should result in the following array</p>
  
  <pre><code> a = array([[1, 2, 0],
             [4, 5, 0],
             [7, 8, 9]])
  </code></pre>
  
  <p>I did following and it resulted in modifying each sequence of column in every row</p>
  
  <pre><code>rows = [0,1]
  cols = [2,2]
  b=a[numpy.ix_(rows,columns)]
  </code></pre>
  
  <p>It resulted in the following array modifying every column of the specified array</p>
  
  <pre><code>array([[1, 0, 0],
         [4, 5, 6],
         [7, 0, 0]])
  </code></pre>
  
  <p>Some one could please let me know how to do it?</p>
  
  <p>Thanks a lot</p>
  
  <p><strong>EDIT: It is to be noted that rows and columns coincidently happend to be sequentia. The actual point is that these could be arbitrary and in any order. if it is rows = [a,b,c] and cols=[n x z] then I want to modify exactly three elements at locations (a,n),(b,x),(c,z).</strong>  </p>