title: Perform math operations inside Python switch case equivalent
body: <p>I am trying to simplify an if-elif-else block in Python with a Switch case equivalent. But I am having issues trying to perform math operations inside the switch case dictionary</p>
  
  <p>I am performing this code inside a FOR loop that is running through a pandas dataframe. Basically doing some math based on a condition. </p>
  
  <p>Sample Dataframe:</p>
  
  <pre><code>10889  103.579   89.160  2.98   2.1154     NaN   in 0.48  0.20   15.0
  10890  103.859   89.133  2.98   2.1266     NaN   out 0.48  0.20   15.0
  10891  104.067   89.133  2.98   2.1349     NaN   out 0.48  0.20   15.0
  10892  106.867   91.933  2.98    2.293     NaN   out 0.48  0.20   15.0
  10893  106.867   91.859  2.98   2.2959     NaN   sol 0.48  0.20   15.0
  10894  106.840   91.579  2.98   2.3072     NaN   sol 0.48  0.20   15.0
  10895  106.785   91.302  2.98   2.3184     NaN   sol 0.48  0.20   15.0
  10896  106.728   91.115  2.98   2.3263     NaN   text 0.48  0.20   15.0
  10897  104.885   89.272  2.98   2.4303     NaN   text 0.48  0.20   15.0
  10898  104.885   89.272  2.98        0     NaN   mid 0.48  0.20   15.0
  </code></pre>
  
  <p>Current piece of code:</p>
  
  <pre><code>       if self.newdataframe.iloc[i]['FT'] in ('in', 'out'):
              self.ext_out += edis
         elif self.newdataframe.iloc[i]['FT'] == 'sol':
              self.ext_sol += edis
         elif self.newdataframe.iloc[i]['FT'] == 'mid':
              self.ext_mid += edis
         elif self.newdataframe.iloc[i]['FT'] == 'text':
              self.ext_text += edis
         else:
              self.ext_other += edis
  </code></pre>
  
  <p>Converting this to a switch case.. Here is my attempt. The code looks something like this but it is obviously throwing errors </p>
  
  <pre><code>newdict = { 'in': self.ext_out += edis,
  'out': self.ext_out += edis,
  'sol': self.ext_sol += edis,
  'mid': self.ext_mid += edis,
  'text': self.ext_text += edis}
  
  newdict[self.newdataframe.iloc[i]['FT']]
  </code></pre>
  
  <p>I tried using Lambda functions but that seems to cause issue with the self. variables. Any pointers or guidance, sample examples are much appreciated</p>