title: How to operate with two differents dataframes in python?
body: <p>I want to make a mathematical operation by comparing the values of the two differents dataframes (A and B).</p>
  <pre><code>A = pd.DataFrame({'a':[1,1,2,2],'s':[10,20,30,40]})
  B = pd.DataFrame({'a':[1,2],'I':[5,10]})
  </code></pre>
  <p>I want add a column to A call A['ss'] in which element is equal to <em>s/(1+I)</em> where I is the value of B['I'] that have the same index of the value of the column B['a'] that is equal to the value of A['a']. I try with:</p>
  <pre><code>A['ss'] = A['s'].apply(lambda s: s/(1+ B['I'].loc[ A['a'].loc[A['s'] == s] == B['a'] ] ) )
  </code></pre>
  <p>but I get</p>
  <pre><code>ValueError: Can only compare identically-labeled Series objects
  </code></pre>