title: Update cells of a pandas DataFrame for a specific row
body: <p>I want to update some cells in a row for a pandas <code>DataFrame</code>, I am using <code>update</code> to do it, but it always modify the first index only, this is a example:</p>
  
  <pre><code>df = pd.DataFrame(data={'cod':[1000,1001], 'B': ['b1','b2'], 'C':['c1','c2']})
  updated_data = pd.DataFrame({'cod':[1001], 'C':['newC1']})
  updated_data2 = pd.DataFrame({'cod':[1000], 'B':['newB1']})
  df.update(updated_data)
  df.update(updated_data2)
  </code></pre>
  
  <p>After this code, df will have:</p>
  
  <pre><code>      cod      B      C
  0  1000.0  newB1  newC1
  1  1001.0     b2     c2
  </code></pre>
  
  <p>When it should be</p>
  
  <pre><code>         cod      B      C
  cod                       
  1000  1000.0  newB1     c1
  1001  1001.0     b2  newC1
  </code></pre>
  
  <p>In order to achieve, I wrote the following code, but do not know if its the best approach:</p>
  
  <pre><code>df = pd.DataFrame(data={'cod':[1000,1001], 'B': ['b1','b2'], 'C':['c1','c2']})
  df = df.set_index(df.cod)
  updated_data = pd.DataFrame({'cod':[1001], 'C':['newC1']})
  updated_data = updated_data.set_index(updated_data.cod)
  df.update(updated_data, overwrite=True)
  updated_data = pd.DataFrame({'cod':[1000], 'B':['newB1']})
  updated_data = updated_data.set_index(updated_data.cod)
  df.update(updated_data, overwrite=True)
  </code></pre>
  
  <p>It seems to me its very verbose for something simple, is there another approach?</p>
  
  <h1>Update</h1>
  
  <p>This is the actual code, instead of having two <code>updated_data</code>, in reality is within a loop:</p>
  
  <pre><code>df = pd.DataFrame(data={'cod':[1000,1001], 'B': ['b1','b2'], 'C':['c1','c2']})
  df = df.set_index(df.cod)
  for i in (1000,1001):
      updated_data = pd.DataFrame({'cod':[i], 'C':['newC1']})
      updated_data = updated_data.set_index(updated_data.cod)
      df.update(updated_data, overwrite=True)
  </code></pre>