title: Pandas: ValueError: cannot convert float NaN to integer
body: <p>I get <strong>ValueError: cannot convert float NaN to integer</strong> for following:</p>
  <pre><code>df = pandas.read_csv('zoom11.csv')
  df[['x']] = df[['x']].astype(int)
  </code></pre>
  <ul>
  <li>The &quot;x&quot; is a column in the csv file, I cannot spot any <em>float NaN</em> in the file, and I don't understand the error or why I am getting it.</li>
  <li>When I read the column as String, then it has values like -1,0,1,...2000, all look very nice int numbers to me.</li>
  <li>When I read the column as float, then this can be loaded. Then it shows values as -1.0,0.0 etc, still there are no any NaN-s</li>
  <li>I tried with <em>error_bad_lines = False</em> and dtype parameter in read_csv to no avail. It just cancels loading with same exception.</li>
  <li>The file is not small (10+ M rows), so cannot inspect it manually, when I extract a small header part, then there is no error, but it happens with full file. So it is something in the file, but cannot detect what.</li>
  <li>Logically the csv should not have missing values, but even if there is some garbage then I would be ok to skip the rows. Or at least identify them, but I do not see way to scan through file and report conversion errors.</li>
  </ul>
  <p>Update: Using the hints in comments/answers I got my data clean with this:</p>
  <pre><code># x contained NaN
  df = df[~df['x'].isnull()]
  
  # Y contained some other garbage, so null check was not enough
  df = df[df['y'].str.isnumeric()]
  
  # final conversion now worked
  df[['x']] = df[['x']].astype(int)
  df[['y']] = df[['y']].astype(int)
  </code></pre>