title: Pandas dataframe: creating a new column that is a custom function using 2 other columns
body: <p>Consider the following data set stored in a pandas DataFrame <code>dfX</code>:</p>
  
  <pre><code>A   B
  1   2
  4   6
  7   9
  </code></pre>
  
  <p>I have a function that is:</p>
  
  <pre><code>def someThingSpecial(x,y)
    # z = do something special with x,y
    return z
  </code></pre>
  
  <p>I now want to create a new column in <code>df</code> that bears the computed z value</p>
  
  <p>Looking at other SO examples, I've tried several variants including:</p>
  
  <pre><code>dfX['C'] = dfX.apply(lambda x: someThingSpecial(x=x['A'], y=x['B']), axis=1)
  </code></pre>
  
  <p>Which returns errors. What is the right way to do this?</p>