title: Detect if a NumPy array contains at least one non-numeric value?
body: <p>I need to write a function which will detect if the input contains at least one value which is non-numeric. If a non-numeric value is found I will raise an error (because the calculation should only return a numeric value). The number of dimensions of the input array is not known in advance - the function should give the correct value regardless of ndim. As an extra complication the input could be a single float or <code>numpy.float64</code> or even something oddball like a zero-dimensional array. </p>
  
  <p>The obvious way to solve this is to write a recursive function which iterates over every iterable object in the array until it finds a non-iterabe. It will apply the <code>numpy.isnan()</code> function over every non-iterable object. If at least one non-numeric value is found then the function will return False immediately. Otherwise if all the values in the iterable are numeric it will eventually return True. </p>
  
  <p>That works just fine, but it's pretty slow and I expect that <a href="http://en.wikipedia.org/wiki/NumPy" rel="noreferrer">NumPy</a> has a much better way to do it. What is an alternative that is faster and more numpyish?</p>
  
  <p>Here's my mockup:</p>
  
  <pre><code>def contains_nan( myarray ):
      """
      @param myarray : An n-dimensional array or a single float
      @type myarray : numpy.ndarray, numpy.array, float
      @returns: bool
      Returns true if myarray is numeric or only contains numeric values.
      Returns false if at least one non-numeric value exists
      Not-A-Number is given by the numpy.isnan() function.
      """
      return True
  </code></pre>