[SciPy-User] load file with "header" in the bottom of the file.

Warren Weckesser warren.weckesser@enthought....
Sat Mar 17 11:32:16 CDT 2012


On Fri, Mar 16, 2012 at 9:26 AM, Petro <khoroshyy@gmail.com> wrote:

> Hi all.
> numpy.loadtxt allows to skip headers line.
> I have a lot of tab-delimited files were description is on the bottom.
> Does anybody know an easy  way  to read such file.
> Thanks in advance.
> Petro.
>


numpy.genfromtxt has a 'skip_footer' argument for ignoring lines at the end
of the file.  For example:


In [5]: !cat test.tsv
100    200    300
400    500    600
This is a test.

In [6]: a = genfromtxt('test.tsv', delimiter='\t', skip_footer=1)

In [7]: a
Out[7]:
array([[ 100.,  200.,  300.],
       [ 400.,  500.,  600.]])


Warren



> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120317/7771651c/attachment.html 


More information about the SciPy-User mailing list