[Numpy-discussion] unpack argument in loadtxt/genfromtxt does not work as documented

Pierre GM pgmdevlist@gmail....
Thu Oct 7 09:04:47 CDT 2010


On Oct 7, 2010, at 4:01 PM, Chris Fonnesbeck wrote:

> On Thu, Oct 7, 2010 at 4:00 AM, Pierre GM <pgmdevlist@gmail.com> wrote:
>> 
>> On Oct 7, 2010, at 4:48 AM, Chris Fonnesbeck wrote:
>> 
>>> The documentation for loadtxt and genfromtxt state that the unpack
>>> argument functions as follows:
>>> 
>>> If True, the returned array is transposed, so that arguments may be
>>> unpacked using x, y, z = loadtxt(...).
>> 
>> Provided that all the columns have the same dtype
>> 
> 
> Aha, I see. Unfortunately that detail is not in the docstrings. This
> is a pretty fundamental limitation of the function, I think, since it
> is rare that a multi-column table of data will be of the same type. I
> wonder if it would be possible to allow an 'obj' type array that could
> be transposed? The way it is now, you have a 1d array representing
> what is fundamentally 2d information.

As I stated in a previous email, please open a ticket to that effect. In the meantime, please use the trick I was giving you to unpack the 1D array w/ several fields into a list of 1D arrays (one for each field).



More information about the NumPy-Discussion mailing list