[Numpy-discussion] ValueError: low level cast function is for unequal type numbers

Christoph Gohlke cgohlke at uci.edu
Fri Dec 7 03:00:45 EST 2012


Hello,

the following code using np.object_ data types works with numpy 1.5.1 
but fails with 1.6.2. Is this intended or a regression? Other data 
types, np.float64 for example, seem to work.

In [1]: import numpy as np

In [2]: np.array(['a'], dtype='O').astype(('O', [('name', 'O')]))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-f4a62241f13c> in <module>()
----> 1 np.array(['a'], dtype='O').astype(('O', [('name', 'O')]))

ValueError: low level cast function is for unequal type numbers

In [3]: np.array([16], dtype='d').astype(('d', [('name', 'd')]))
Out[3]: array([ 16.])


These downstream issues could be related:

http://code.google.com/p/h5py/issues/detail?id=217
https://github.com/CellProfiler/CellProfiler/issues/421

Thank you,

Christoph





More information about the NumPy-Discussion mailing list