title: Use pandas DataFrame / Panel .apply() together with index/column information
body: <p>I have a pandas DataFrame that looks like this:</p>
  
  <pre><code>           2016      2017      2018      2019      2020
  1  0.014199  0.020776  0.016393  0.010112  0.013346
  2  0.025220  0.024088  0.035357  0.026878  0.031841
  3  0.016345  0.014117  0.017157  0.019280  0.017307
  4  0.021467  0.020389  0.027269  0.027727  0.025750
  5  0.012459  0.004377  0.015435  0.023725  0.031228
  </code></pre>
  
  <p>And a function that looks like this:</p>
  
  <pre><code>def f(a,b):
     return a+b
  </code></pre>
  
  <p>I am looking for a fast (i.e., avoiding loops) way of calculating f for every element in the dataframe with <code>a</code> being the entry and <code>b</code> its column name (or index, if that also works). </p>
  
  <p>Output would then look like this:</p>
  
  <pre><code>    2016             2017
  1   2016.014199      2017.020776 ...
  2   2016.025220      2017.024088 ...
  </code></pre>
  
  <p>I have been trying the .apply() functionality but haven't found out how to make it work. Do you have any tips?</p>
  
  <p>KR, Richard</p>