title: Efficiently checking if arbitrary object is NaN in Python / numpy / pandas?
body: <p>My numpy arrays use <code>np.nan</code> to designate missing values. As I iterate over the data set, I need to detect such missing values and handle them in special ways.</p>
  
  <p>Naively I used <code>numpy.isnan(val)</code>, which works well unless <code>val</code> isn't among the subset of types supported by <code>numpy.isnan()</code>. For example, missing data can occur in string fields, in which case I get:</p>
  
  <pre><code>&gt;&gt;&gt; np.isnan('some_string')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: Not implemented for this type
  </code></pre>
  
  <p>Other than writing an expensive wrapper that catches the exception and returns <code>False</code>, is there a way to handle this elegantly and efficiently?</p>