[Numpy-discussion] Numpy 2.0 schedule

Benjamin Root ben.root@ou....
Mon Feb 28 09:47:54 CST 2011


On Mon, Feb 28, 2011 at 9:25 AM, Bruce Southey <bsouthey@gmail.com> wrote:

> On 02/28/2011 09:02 AM, Benjamin Root wrote:
> [snip]
> >
> >
> > So, is there still no hope in addressing this old bug report of mine?
> >
> > http://projects.scipy.org/numpy/ticket/1562
> >
> > Ben Root
> >
> I think you need to add more details to this. So do you have an example
> of the problem that includes code and expected output?
>
> Perhaps genfromtxt is probably more appropriate than loadtxt for what
> you want:
>
> from StringIO import StringIO
> import numpy as np
> t = StringIO("1,1.3,abcde\n2,2.3,wxyz\n1\n3,3.3,mnop")
> data = np.genfromtxt(t,
> [('myint','i8'),('myfloat','f8'),('mystring','S5')], names =
> ['myint','myfloat','mystring'], delimiter=",", invalid_raise=False)
> print 'Bad data raise\n',data
>
> This gives the output that skips the incomplete 3rd line:
>
> /usr/lib64/python2.7/site-packages/numpy/lib/npyio.py:1507:
> ConversionWarning: Some errors were detected !
>     Line #3 (got 1 columns instead of 3)
>   warnings.warn(errmsg, ConversionWarning)
> Bad data raise
> [(1, 1.3, 'abcde') (2, 2.3, 'wxyz') (3, 3.3, 'mnop')]
>
>
> Bruce
>
>
Bruce,

I think you mis-understood the problem I was reporting.  You can find the
discussion thread here:

http://www.mail-archive.com/numpy-discussion@scipy.org/msg26235.html

I have proposed that at the very least, an example of this problem is added
to the documentation of loadtxt so that users know to be aware of this
possibility.

In addition, loadtxt fails on empty files even when provided with a dtype.
I believe genfromtxt also fails as well in this case.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110228/5ce1328d/attachment-0001.html 


More information about the NumPy-Discussion mailing list