title: apply function to pandas column based on list of dictionaries
body: <p>Imagine I have a list of dictionaries as follows:</p>
  <pre><code>[{'source_id': '1', 'source_desc': 'XML1'},
   {'source_id': '2', 'source_desc': 'XML2'},
   {'source_id': '3', 'source_desc': 'XML3'}]
  </code></pre>
  <p>Now I have a pandas dataframe as:</p>
  <pre><code>di = [{'source_id': '1','city':'NY'},
         {'source_id': '2','city':'Santiago'},
         {'source_id': '3','city':'Berlin'}]
  dff=pd.DataFrame(di)
  dff
  </code></pre>
  <p>Now I want to add a column source_desc based on the previous collection of dictionaries.
  I tried:</p>
  <pre><code>dff['source_desc'] = dff['source_id'].astype(str).apply(lambda x: d['source_desc'] for d in di if d['source_id'] == x)
  </code></pre>
  <p>I dont understand why this does not work.</p>
  <p>EDIT:
  desired output would be a pandas df like:</p>
  <pre><code>desired = [{'source_id': '1','city':'NY','source_desc': 'XML1' },
         {'source_id': '2','city':'Santiago','source_desc': 'XML2'},
         {'source_id': '3','city':'Berlin','source_desc': 'XML3'}]
  desired_df=pd.DataFrame(desired)
  desired_df
  </code></pre>