[Numpy-discussion] `missing` argument in genfromtxt only a string?

Skipper Seabold jsseabold at gmail.com
Tue Sep 15 00:50:55 EDT 2009


On Mon, Sep 14, 2009 at 11:40 PM, Pierre GM <pgmdevlist at gmail.com> wrote:
>
> On Sep 14, 2009, at 10:55 PM, Skipper Seabold wrote:
>>
>> While we're on the subject, the other thing on my wishlist (unless I
>> just don't know how to do this) is being able to define a "column map"
>> for datasets that have no delimiters.  At first each observation of my
>> data was just one long string with no gaps or regular breaks but I
>> knew which columns had what.  Eg., the first variable was (not
>> zero-indexed) columns 1-6, the second columns 11-15, the third column
>> 16, etc.  so I would just say delimiter = [1:6,11:15,16,...].
>
> Fixed-width fields should already be supported. Instead of delimiter=
> [1-6, 7-10, 11-15, 16]..., use delimiter=[6, 4, 4, 1] (that is, just
> give the widths of the fields).
> Note that I wouldn't be surprised at all if it failed for some corner
> cases (eg, if you need to read the name from the first line).
>

Doh, so it does!  The docstring could probably note this unless I just
missed it somewhere.

Thanks,

Skipper



More information about the NumPy-Discussion mailing list