title: How to replace values according to non-consecutive list of indices in pandas dataframe?
body: <p>I have been looking for a quick and efficient way to replace values in a given column of a pandas dataframe only if the corresponding indices belong to a list of non-consecutive numbers.
  Say non_consecutive_indices_list = [1400, 6571, 14526, 68420, ...] with ca. 30k different values.</p>
  
  <ol>
  <li><p>I have tried to use .iloc but I get an error message:</p>
  
  <pre><code>df.iloc[non_consecutive_indices_list, 'column'] = New_Value
  </code></pre></li>
  </ol>
  
  <p>ValueError: Can only index by location with a [integer, integer slice (START point is INCLUDED, END point is EXCLUDED), listlike of integers, boolean array].</p>
  
  <ol start="2">
  <li><p>Alternatively, I have tried the following:</p>
  
  <pre><code>df.iloc[non_consecutive_indices_list].column = New_Value
  </code></pre></li>
  </ol>
  
  <p>But this returns a copy of the original dataframe so I cannot replace the original values.</p>
  
  <ol start="3">
  <li><p>Finally, I have tried to use a for loop, which works, but this is very inefficient and takes forever to replace about 30k values:</p>
  
  <pre><code>for i in non_consecutive_indices_list:
      df.loc[i, 'column'] = New_Value
  </code></pre></li>
  </ol>
  
  <p>Any idea how this could be done in a fastest way?</p>