[Numpy-discussion] genloadtxt: dtype=None and unpack=True

Ryan May rmay31@gmail....
Wed Feb 11 22:38:20 CST 2009


Pierre,

I noticed that using dtype=None with a heterogeneous set of data, trying to
use unpack=True to get the columns into separate arrays (instead of a
structured array) doesn't work.  I've attached a patch that, in the case of
dtype=None, unpacks the fields in the final array into a list of separate
arrays.  Does this seem like a good idea to you?

Here's a test case:

from cStringIO import StringIO
s = '2,1950-02-27,35.55\n2,1951-02-19,35.27\n'
a,b,c = np.genfromtxt(StringIO(s), delimiter=',', unpack=True, missing=' ',
dtype=None)

Ryan

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090211/88c28915/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genloadtxt_unpack_fields.diff
Type: application/octet-stream
Size: 480 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090211/88c28915/attachment-0001.obj 


More information about the Numpy-discussion mailing list