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
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
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
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.
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