views:

39

answers:

1

I do:

print "e: ", scaled_target, type(scaled_target)
print "f: ", numpy.isnan(scaled_target)

which returns

e:  [0.0 0.0 0.0 0.0] <type 'numpy.ndarray'>
f: 
Traceback (most recent call last):
  File "./a.py", line 106, in <module>
    print "f: ", numpy.isnan(scaled_target)
TypeError: function not supported for these types, and can't coerce safely to supported types

The manual says that numpy.isnan accepts ndarray. I'm not sure what's going wrong.

A: 

For me, the following works:

e = numpy.zeros(4)
numpy.isnan(e)

gives:

array([False, False, False, False], dtype=bool)

where

print type(e)

gives:

<type 'numpy.ndarray'>
Andre Holzner