[Numpy-discussion] genfromtxt usage

Stéfan van der Walt stefan@sun.ac...
Wed Aug 25 04:02:12 CDT 2010


Hi Antoine

On 25 August 2010 10:44, Antoine Dechaume <boolegue@gmail.com> wrote:
> Hello,
> I am trying to read a file with a variable number of values on each lines,
> using genfromtxt and missing_values or filling_values arguments.
> The usage of those arguments is not clear in the documentation, if what I am
> trying to do is possible, how could I do it?

Neither loadtxt nor genfromtxt were written with a variable number of
values in mind.  The result is returned as an array, and therefore has
to have a set number of columns.  In this case, you may be better off
writing your own reader, or padding your lines with zeros as
appropriate.

Regards
Stéfan


More information about the NumPy-Discussion mailing list