title: Update dataframe according to another dataframe based on certain conditions
body: <p>I have two dataframes <code>df1</code> and <code>df2</code>. Df1 has columns A,B,C,D,E,F and <code>df2</code> A,B,J,D,E,K. I want to update the second dataframe with the rows of the first but only when two first columns have the same value in both dataframes. For each row that the following two conditions are true: </p>
  
  <ol>
  <li><code>df1.A = df2.A</code>  </li>
  <li><code>df1.B = df2.B</code> </li>
  </ol>
  
  <p>then update accordingly:  </p>
  
  <pre><code>df2.D = df1.D  
  df2.E = df1.E
  </code></pre>
  
  <p>My dataframes have different number of rows. </p>
  
  <p>When I tried this code I get a TypeError :cannot do positional indexing with these indexers of type 'str'.</p>
  
  <pre><code>for a in df1:
      for t in df2:
          if df1.iloc[a]['A'] == df2.iloc[t]['A'] and df1.iloc[a]['B'] == df2.iloc[t]['B']:
              df2.iloc[t]['D'] = df1.iloc[a]['D']
              df2.iloc[t]['E'] = df1.iloc[a]['E']
  </code></pre>