[Numpy-discussion] Strange error taking log of PyObject array

Travis Oliphant oliphant.travis at ieee.org
Mon Jul 10 20:46:21 CDT 2006

Tom Denniston wrote:
> The following works on a float array but not an object array.  It
> gives a very strange error message.
> (Pdb) numpy.log(numpy.array([19155613843.7], dtype=object))
> *** AttributeError: 'float' object has no attribute 'log'
This is expected behavior.  For object arrays the ufuncs look to the 
objects themselves for implementation.   In this case.  The ufunc tries 
to call the log method of each entry in the array.  The first entry is a 
float (which as the error shows) does not have a log attribute and so 
you get a failure.


More information about the Numpy-discussion mailing list