title: calculating a new column in Pandas using dictionary values and keys
body: <p>I have a data frame that contains a list of order <code>order_items</code> and their total price <code>order_price</code>.
  The column <code>order_type</code> includes the order type: breakfast, lunch or dinner.</p>
  
  <p>My goal is to confirm that that the given total <code>order_price</code> is correct. By multiplying the quantities (the second item in the tuple) by the item price. Then sum all the prices for one order and store it in a new column <code>order_price_checked</code>.</p>
  
  <p>sample of my dataset:</p>
  
  <pre><code>    order_id    order_items                                                     order_type  order_price
  0   ORDB10489   [('Coffee', 4), ('Salad', 10), ('Chicken', 8), ('Steak', 10)]   Lunch       1002.00
  1   ORDZ00319   [('Fish&amp;Chips', 9), ('Pasta', 5), ('Shrimp', 3)]                Dinner      614.50
  2   ORDB00980   [('Pasta', 6), ('Fish&amp;Chips', 10)]                              Dinner      515.00
  3   ORDY10003   [('Chicken', 7), ('Steak', 1)]                                  Lunch       269.00
  4   ORDK04121   [('Steak', 9), ('Chicken', 5)]                                  Lunch       565.00
  5   ORDC10404   [('Burger', 3), ('Salad', 6), ('Fries', 7)]                     Lunch       280.20
  6   ORDK05183   [('Chicken', 1), ('Steak', 10), ('Fries', 4), ('Salad', 6)]     Lunch       633.20
  </code></pre>
  
  <p>I have stored the prices for each <code>order_type</code> in a seperate dictionary.
  For instance, <code>lunchDict</code> is for lunch orders.</p>
  
  <pre><code>{'Burger': 31.0, 'Fries': 12.0, 'Chicken': 32.0, 'Salad': 17.2, 'Steak': 45.0}
  </code></pre>
  
  <p>My approach is to match the first item in the tuple with the dictionary key. If it matches the key, then I will multiply the second item in the tuple (quantity) by the value of the corresponding key(price). 
  Then obtain the total of all the orders and add it to a new column <code>order_price_checked</code>.</p>
  
  <p>desired output(<em>I am only showing two columns to save space</em>):
  for example index 1 and 4 show that we have wrong price. </p>
  
  <pre><code>     order_price   order_price_checked
     0    1002.00     1002.00
     1    614.50      600.20
     2    515.00      515.00
     3    269.00      269.00
     4    565.00      500.00
     5    280.20      280.20
     6    633.20      633.20
  </code></pre>
  
  <p>I tried to do it in a <code>for loop</code>:</p>
  
  <pre><code>for item in dirtyData['order_items']:
      for mytuple in item:
          if mytuple[0] in breakfastDict:
              tot=mytuple[1]*breakfastDict[mytuple[0]]
  print(tot)
  </code></pre>
  
  <p>but this is not a clear approach and I can't tell which row I am working on.
  Any input would be helpful. Thanks</p>