title: Pandas: How to efficiently replace <NA> values in a range of specific rows?
body: <p>In light of the COVID-19 pandemic, I have been working with some of the data and come across a comprehensive and updated source for cases/deaths/etc:
  <a href="https://opendata.ecdc.europa.eu/covid19/casedistribution/csv" rel="nofollow noreferrer">https://opendata.ecdc.europa.eu/covid19/casedistribution/csv</a></p>
  
  <p>There are some missing data, but instead of taking out my 'dropna' sledgehammer, I wanted to see what was going on and recover anything that could be recovered. It turns out that the two-letter country code of Namibia is 'NA,' and is seen as missing when imported.</p>
  
  <p>I am working in Pandas 1.0.1 so I started out converting the columns to a string:</p>
  
  <pre><code>dt = pd.read_csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv")    
  dt['geoId'] = dt['geoId'].astype('string')
  </code></pre>
  
  <p>Now I could have just used a '.fillna()' at the end of that but I wanted to handle any future cases where there were real NaNs.</p>
  
  <p>My solution seems like a bit of a hack and probabaly not optimal:</p>
  
  <pre><code>namibia_rows = dt['geoId'][dt['countriesAndTerritories'] == 'Namibia'].index
  for x in namibia_rows:
      dt.loc[x, 'geoId'] = 'NA' 
  </code></pre>
  
  <p>Is there a better way to do this using a single line and a built-in Pandas function?</p>