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

Ryan May rmay31 at gmail.com
Wed Feb 11 23:38:20 EST 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://mail.python.org/pipermail/numpy-discussion/attachments/20090211/88c28915/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genloadtxt_unpack_fields.diff
Type: application/octet-stream
Size: 481 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090211/88c28915/attachment.obj>


More information about the NumPy-Discussion mailing list