title: how to apply lambda functions to rows meeting a condition in PANDAS
body: <p>I am trying to apply a function row-wise to a pandas dataframe with the following</p>
  
  <pre><code>df.loc[df.var1==123,'coltoChange']=df.apply(lambda row: myfunc(row.var1, row.var2),axis=1)
  </code></pre>
  
  <p>The idea is to apply the function only to rows where value of <code>var1</code> is <code>123</code>. But when I run this statement, it still tries to run every single row in the dataframe.</p>