title: Pandas: Replace column values in DataFrame based on the json object
body: <p>I have a json object called 'countries' like below with all the countries ISO code list:</p>
  
  <pre><code>countries = [{"name":"Afghanistan","alpha-2":"AF","country-code":"004"},{"name":"Åland Islands","alpha-2":"AX","country-code":"248"},{"name":"Albania","alpha-2":"AL","country-code":"008"},{"name":"Algeria","alpha-2":"DZ","country-code":"012"}]
  </code></pre>
  
  <p>I have a pandas dataframe with 'Country' column:</p>
  
  <pre><code>Country
  --------
  Albania
  Algeria
  Algeria
  </code></pre>
  
  <p>I want to replace the Country column 'name' with the 'alpha-2' value from the json object. The result should be like :</p>
  
  <pre><code>Country
  ---------
  AL
  DZ
  DZ
  </code></pre>
  
  <p>I am trying to do something like this which does not give any error nor changes the values.</p>
  
  <pre><code>df['Country'] = df['Country'].replace(lambda y: (x['alpha-2'] for x in countries) if y in (x['name'] for x in countries) else y)
  </code></pre>