title: How to use map/reduce on Python Ordered dictionary
body: <p>I have a nested python dictionary like this :</p>
  
  <pre><code>my_dictionary = {"Ab" : {'name': 'usa', 'boolean': 'YES'},
  "Ac" : {'name': 'usa', 'boolean': 'NO'},
  "Ad": {'name': 'UK', 'boolean': 'NO'},
  "Ae": {'name': 'UK', 'boolean': 'NO'}}
  </code></pre>
  
  <p>I created an ordered dictionary from the above dictionary like this :</p>
  
  <pre><code>from collections import OrderedDict
  sorted_dict = OrderedDict(sorted(my_dictionary.iteritems(), key=lambda x: x[1]['name']))
  print sorted_dict
  </code></pre>
  
  <p>This gives:</p>
  
  <pre><code>OrderedDict([("Ab", {'name': 'usa', 'boolean': 'YES'}),
  ("Ac", {'name': 'usa', 'boolean': 'NO'}),
  ("Ad", {'name': 'UK', 'boolean': 'NO'}),
  ("Ae", {'name': 'UK', 'boolean': 'NO'})])
  </code></pre>
  
  <p>I need to add a new column ('result') to the ordered dictionary. The logic for creating the new column is as follows:</p>
  
  <p>Collect all rows which have the same 'name' : here 'usa' and 'UK'. Then apply reduce method based on 'boolean' column. The function should be binary 'OR' (||).</p>
  
  <p>I tried to apply reduce like this :</p>
  
  <pre><code>reduce(lambda x,y: x['boolean'] or y['boolean']
  </code></pre>
  
  <p>but got stuck in choosing all the rows with same 'name'.</p>
  
  <p>So the final Ordered dictionary will look like :</p>
  
  <pre><code>OrderedDict([("Ab", {'name': 'usa', 'boolean': 'YES', 'result': 'YES'}),
  ("Ac", {'name': 'usa', 'boolean': 'NO', 'result': 'YES'}),
  ("Ad", {'name': 'UK', 'boolean': 'NO', 'result': 'NO'}),
  ("Ae", {'name': 'UK', 'boolean': 'NO', 'result': 'NO'})])
  </code></pre>