[Numpy-discussion] loadtxt stop

Neil Hodgson hodgson.neil@yahoo.co...
Fri Sep 17 07:40:53 CDT 2010


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  




________________________________
From: Neil Hodgson <hodgson.neil@yahoo.co.uk>
To: numpy-discussion@scipy.org
Sent: Fri, 17 September, 2010 14:17:12
Subject: loadtxt stop


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 was a possibility 
to put an endmarker= ?

For example, if I want to load text from a large! file that looks like this

header line 
header line
1 2.0 3.0
2 4.5 5.7
...
500 4.3 5.4
END
more headers
more headers
1 2.0 3.0 3.14 1.1414
2 4.5 5.7 1.14 3.1459
...
500 4.3 5.4 0.000 0.001
END

Then I can use skiprows=2, but loadtxt will choke when it gets to 'END'.  To 
read t


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100917/37c61519/attachment.html 


More information about the NumPy-Discussion mailing list