[Numpy-discussion] Conversion from structured dtype to object changed in Numpy 1.6.0.
Mark Dickinson
mdickinson at enthought.com
Thu May 19 07:36:22 EDT 2011
With numpy 1.5.1:
Python 2.7.1 |EPD 7.0-2 (32-bit)| (r271:86832, Dec 3 2010, 15:41:32)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import array
>>> x = array((1.2, 2.3), dtype=[('field1', float), ('field2', float)])
>>> x.astype(object)
array((1.2, 2.3), dtype=object)
>>>
So the conversion from the structured dtype item to type 'object'
produces a tuple, which makes sense. With numpy 1.6.0, the same
computation gives a different result, apparently truncating the tuple:
Python 2.7.1 |EPD 7.0-2 (32-bit)| (r271:86832, Dec 3 2010, 15:41:32)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import array
>>> x = array((1.2, 2.3), dtype=[('field1', float), ('field2', float)])
>>> x.astype(object)
array(1.2, dtype=object)
>>>
Was this change intentional, or should I file a bug? I couldn't find
any reference to it in the changelog or release notes.
Thanks,
Mark
More information about the NumPy-Discussion
mailing list