title: Vectorized update to pandas DataFrame?
body: <p>I have a dataframe for which I'd like to update a column with some values from an array. The array is of a different lengths to the dataframe however, but I have the indices for the rows of the dataframe that I'd like to update.</p>
  
  <p>I can do this with a loop through the rows (below) but I expect there is a much more efficient way to do this via a vectorized approach, but I can't seem to get the syntax correct.</p>
  
  <p>In the example below I just fill the column with <code>nan</code> and then use the indices directly through a loop.</p>
  
  <pre><code>df['newcol'] = np.nan
  
  j = 0
  for i in update_idx:
      df['newcol'][i] = new_values[j]
      j+=1
  </code></pre>