title: Numpy array modifying multiple elements at once
body: <p>I have three numpy arrays:</p>
  
  <pre><code>row = np.array([1,2,3,4,5])
  
  # a is a subset of row:
  
  a = np.array([1, 5])
  
  # b is an array that I use to change some elements in the first row array:
  
  b = np.array([10, 550])
  </code></pre>
  
  <p>What I need to do is to change <strong>in one shot</strong> the elements of the row array that are present in a with the correspondent b elements. </p>
  
  <p>i.e.:</p>
  
  <pre><code>&gt;&gt; modified_row
  array([10, 2, 3, 4, 500])
  </code></pre>
  
  <p>Doing this in a naive way would be:</p>
  
  <pre><code>for i in range(len(a)):
      row[np.where(row==a[i])]= b[i]
  </code></pre>
  
  <p>I would like a solution like;</p>
  
  <pre><code>row[np.where(row==a)] = b
  </code></pre>
  
  <p>But that doesn't work...</p>
  
  <p>Thanks in advance!</p>