title: python: convert numerical data in pandas dataframe to floats in the presence of strings
body: <p>I've got a pandas dataframe with a column 'cap'. This column mostly consists of floats but has a few strings in it, for instance at index 2.</p>
  
  <pre><code>df =
      cap
  0    5.2
  1    na
  2    2.2
  3    7.6
  4    7.5
  5    3.0
  ...
  </code></pre>
  
  <p>I import my data from a csv file like so:</p>
  
  <pre><code>df = DataFrame(pd.read_csv(myfile.file))
  </code></pre>
  
  <p>Unfortunately, when I do this, the column 'cap' is imported entirely as strings. I would like floats to be identified as floats and strings as strings. Trying to convert this using:</p>
  
  <pre><code>df['cap'] = df['cap'].astype(float)
  </code></pre>
  
  <p>throws up an error:</p>
  
  <pre><code>could not convert string to float: na
  </code></pre>
  
  <p>Is there any way to make all the numbers into floats but keep the 'na' as a string?</p>