[NumPy-Tickets] [NumPy] #1636: genfromtxt bug with usecols and names=True
NumPy Trac
numpy-tickets@scipy....
Tue Oct 12 16:43:35 CDT 2010
#1636: genfromtxt bug with usecols and names=True
------------------------+---------------------------------------------------
Reporter: jseabold | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.lib | Version: 1.5.0
Keywords: genfromtxt |
------------------------+---------------------------------------------------
{{{
from stringIO import stringIO
import numpy as np
#np.__version__
#1.5.0
s = StringIO("col0,col1,col2,col3,col4\n0,1,2,3,4\n0,1,2,3,4\n0,1,2,3,4")
arr = np.genfromtxt(s, names=True, usecols=(0,2,4), delimiter=",",
dtype=['int','int','int'])
arr.dtype.names
#('col0', 'col1', 'col2')
}}}
Interestingly in trying to reproduce, I mistyped the dtype and got the
expected names (but no error on my bad dtype).
{{{
arr = np.genfromtxt(s, names=True, usecols=(0,2,4), delimiter=",",
dtype=['int','int','int','int','int'])
arr.dtype.names
#('col0', 'col2', 'col4')
It also works as expected with dtype=None.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1636>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list