>> Though, really, it's annoying that numpy.loadtxt needs both the
>> readline function *and* the iterator protocol. If it just used
>> iterators, you could do:
>>
>> def truncator(fh, delimiter='END'):
>> for line in fh:
>>if line.strip() == delimiter:
>> break
>>yield line
>>
>> num
On Fri, Sep 17, 2010 at 3:04 PM, Zachary Pincus wrote:
> On Sep 17, 2010, at 3:59 PM, Benjamin Root wrote:
>
> > So, this code will still raise an error for an empty file.
> > Personally, I consider that a bug because I would expect to receive
> > an empty array. I could understand raising an err
On Sep 17, 2010, at 3:59 PM, Benjamin Root wrote:
> So, this code will still raise an error for an empty file.
> Personally, I consider that a bug because I would expect to receive
> an empty array. I could understand raising an error for a non-empty
> file that does not contain anything u
On Fri, Sep 17, 2010 at 2:50 PM, Zachary Pincus wrote:
> > Though, really, it's annoying that numpy.loadtxt needs both the
> > readline function *and* the iterator protocol. If it just used
> > iterators, you could do:
> >
> > def truncator(fh, delimiter='END'):
> > for line in fh:
> > if li
> Though, really, it's annoying that numpy.loadtxt needs both the
> readline function *and* the iterator protocol. If it just used
> iterators, you could do:
>
> def truncator(fh, delimiter='END'):
> for line in fh:
> if line.strip() == delimiter:
> break
> yield line
>
> numpy.load
>> In the end, the question was; is worth adding start= and stop=
>> markers
>> into loadtxt to allow grabbing sections of a file between two known
>> headers? I imagine it's something that people come up against
>> regularly.
Simple enough to wrap your file in a new file-like object that st
Neil Hodgson wrote:
> In the end, the question was; is worth adding start= and stop= markers
> into loadtxt to allow grabbing sections of a file between two known
> headers? I imagine it's something that people come up against regularly.
maybe not so regular. However, a common use would be to b
On Sep 17, 2010, at 2:40 PM, Neil Hodgson wrote:
> oops, I meant to save my post but I sent it instead - doh!
>
> In the end, the question was; is worth adding start= and stop= markers into
> loadtxt to allow grabbing sections of a file between two known headers? I
> imagine it's something t
oops, I meant to save my post but I sent it instead - doh!
In the end, the question was; is worth adding start= and stop= markers into
loadtxt to allow grabbing sections of a file between two known headers? I
imagine it's something that people come up against regularly.
Thanks,
Neil
___
Hi,
I been looking around and could spot anything on this. Quite often I want to
read a homogeneous block of data from within a file. The skiprows option is
great for missing out the section before the data starts, but if there is
anything below then loadtxt will choke. I wondered if there w
10 matches
Mail list logo