[Numpy-discussion] greedy loadtxt

2008-03-27 Thread lorenzo bolla
Hi all! I realized that numpy.loadtxt do not read the last character of an input file. This is annoying if the input file do not end with a newline. For example: data.txt --- 1 2 3EOF In [33]: numpy.loadtxt('data.txt') Out[33]: array([ 1., 2.]) While: data.txt --- 1 2 3 EOF In

Re: [Numpy-discussion] greedy loadtxt

2008-03-27 Thread Alan G Isaac
On Thu, 27 Mar 2008, lorenzo bolla apparently wrote: I realized that numpy.loadtxt do not read the last character of an input file. This is annoying if the input file do not end with a newline. I believe Robert fixed this; update from the SVN repository. hth, Alan Isaac

Re: [Numpy-discussion] greedy loadtxt

2008-03-27 Thread Christopher Barker
Alan G Isaac wrote: I believe Robert fixed this; update from the SVN repository. lorenzo bolla wrote: Should I use numpy.fromfile, instead? You can also do that. If fromfile() supports your data format, it will be much faster. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency

Re: [Numpy-discussion] greedy loadtxt

2008-03-27 Thread lorenzo bolla
Thank you all. The problem with fromfile() is that it doesn't know anything about ndarrays. If my file is a table of ncols and nrows, fromfile() will give me a 1darray with nrows*ncols elements, while loadtxt() will give me a 2dmatrix nrows x ncols. In other words, I loose the shape of the table.

Re: [Numpy-discussion] greedy loadtxt

2008-03-27 Thread Christopher Barker
lorenzo bolla wrote: The problem with fromfile() is that it doesn't know anything about ndarrays. If my file is a table of ncols and nrows, fromfile() will give me a 1darray with nrows*ncols elements, while loadtxt() will give me a 2dmatrix nrows x ncols. In other words, I loose the shape of