thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

genfromtxt bug with delimiter is int type (migrated from Trac #1656) #3207

Closed thouis closed 12 years ago

thouis commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/1656 Reported 2010-10-31 by trac user sunqiang, assigned to atmention:pierregm.

from userguide http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#the-delimiter-argument (the second example):

import numpy as np from StringIO import StringIO data = " 1 2 3\n 4 5 67\n890123 4"

np.genfromtxt(StringIO(data), delimiter=3)

Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 1451, in genfrom txt raise ValueError(errmsg) ValueError: Some errors were detected ! Line #3 (got 3 columns instead of 4)

np.version '1.5.1rc1'

quick and dirty fix: insert "line = line.rstrip()" at line 212 of C:\Python27\Lib\site-packages\numpy\lib_iotools.py, aka, the first line of method _fixedwidth_splitter(self, line) of class LineSplitter:

thouis commented 12 years ago

Comment in Trac by atmention:pierregm, 2010-11-13

Should be fixed on git.

Please test and let me know how it goes before I can close the ticket.

thouis commented 12 years ago

Comment in Trac by trac user sunqiang, 2010-11-14

Replying to [comment:1 pierregm]:

Should be fixed on git.

Please test and let me know how it goes before I can close the ticket. it works, thanks for your work.

thouis commented 12 years ago

Comment in Trac by atmention:pierregm, 2010-11-14

OK, closing.