[Numpy-discussion] dtype and shape for 1.6.1 seems broken?

Charles R Harris charlesr.harris@gmail....
Thu Aug 18 23:32:44 CDT 2011


On Thu, Aug 18, 2011 at 9:45 PM, Christoph Gohlke <cgohlke@uci.edu> wrote:

>
>
> On 8/18/2011 7:24 PM, Robert Love wrote:
> >
> > This works under 1.5.1 and 1.6.0 but gives me errors in 1.6.1
> >
> > import numpy as np
> >
> > def main():
> >
> > print"numpy version: "+ np.__version__
> >
> > zdt = np.dtype([('et','i4'),('r','f8',3)])
> >
> > zdata = np.loadtxt('zdum.txt', zdt)
> >
> > In 1.6.1 I get this error:
> >
> > ValueError: setting an array element with a sequence. Is this a known
> > problem?
> >
>
> This looks like <http://projects.scipy.org/numpy/ticket/1936>
>
> The ValueError is raised in "numpy\lib\npyio.py", line 804, in loadtxt.
>
> Npyio.py is identical for numpy 1.6.0 and 1.6.1.
>
> This is an actual function call from line 804, which works in numpy
> 1.6.0 but fails with 1.6.1:
>
> >>> np.array([(0, ((0., 0., 0.),))], dtype=[('et', '<i4'), ('r', '<f8',
> (3,))])
>
>
Looks malformed, shouldn't that be

In [16]: np.array((0, (0., 0., 0.)), dtype=[('et', '<i4'), ('r', '<f8',
(3,))])
Out[16]:
array((0, [0.0, 0.0, 0.0]),
      dtype=[('et', '<i4'), ('r', '<f8', (3,))])

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110818/9a245c59/attachment.html 


More information about the NumPy-Discussion mailing list