title: Replacing missing values & updating old values in a dataframe using Numpy and Pandas
body: <p>I'm trying to replace missing values reflected by '...' in my dataframe with <code>np.nan</code> values.
  I also want to update some old values, but my method seems not working.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import numpy as np 
  import pandas as pd 
  
  
  def func():
      energy=pd.ExcelFile('Energy Indicators.xls').parse('Energy')
      energy=energy.iloc[16:][['Environmental Indicators: Energy','Unnamed: 3','Unnamed: 4','Unnamed: 5']].copy()
      energy.columns=['Country', 'Energy Supply', 'Energy Supply per Capita', '% Renewable']
      o="..."
      n=np.NaN
  
      # Trying to replace missing values with np.nan values 
      energy[energy['Energy Supply']==o]=n
  
  
      energy['Energy Supply']=energy['Energy Supply']*1000000
  
  
      # Here, I want to replace old values by new ones ==&gt; Same problem 
      old=["Republic of Korea","United States of America","United Kingdom of " 
                                  +"Great Britain and Northern Ireland","China, Hong "
                                  +"Kong Special Administrative Region"]
      new=["South Korea","United States","United Kingdom","Hong Kong"]
      for i in range(0,4):
  
  
          energy[energy['Country']==old[i],'Country']=new[i]
  
  
      return energy
  </code></pre>
  
  <p>Here is the <code>.xls</code> file I'm working on: <a href="https://drive.google.com/file/d/0B80lepon1RrYeDRNQVFWYVVENHM/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/0B80lepon1RrYeDRNQVFWYVVENHM/view?usp=sharing</a></p>