title: How to use a vectorized operation based on column names?
body: <p>Let's say I have a set-up like this</p>
  <pre><code>import pandas as pd 
  
  def dummy(val1, val2):
      return val1 * val2 / 10
  
  
  df = pd.DataFrame({'a': range(1, 3), 'b': range(2, 4), 'c': range(3, 5)})
  d = {'a': 3, 'b': 10}
  
     a  b  c
  0  1  2  3
  1  2  3  4
  </code></pre>
  <p>Now I would like to apply <code>dummy</code> to the columns in <code>df</code> which exist as keys in <code>d</code> and add new columns; thereby <code>val1</code> refers to the values in the respective columns and <code>val2</code> to the value in <code>d</code> for the respective key.</p>
  <p>I could do it like this</p>
  <pre><code>for k, v in d.items():
      # d[k] is of course just v; it's just to show that k is required for both input values
      df[f'{k}_calc'] = dummy(df[k], d[k])
  </code></pre>
  <p>which gives me the desired outcome</p>
  <pre><code>   a  b  c  a_calc  b_calc
  0  1  2  3     0.3     2.0
  1  2  3  4     0.6     3.0
  </code></pre>
  <p>Is there a more straightforward implementation available that avoids the loop?</p>