[Numpy-discussion] can savetxt write arrays with ndim > 2 ?

Mark Bakker markbak@gmail....
Tue Sep 28 03:26:28 CDT 2010

Hello list,

I tried to savetxt an array with ndim = 3, but I get an error:

In [252]: savetxt('test.dat',a)

in savetxt(fname, X, fmt, delimiter)
    785     for row in X:
--> 786         fh.write(format % tuple(row) + '\n')
    788 import re

TypeError: float argument required, not numpy.ndarray

I don't see this anywhere in the documentation of savetxt. And if that is a
restriction it should probably be caught with an assertion.

Numpy version 1.4.0.
I see why ndim>2 may cause problems, as there is now way on 'loadtxt' to
figure out the shape of the array, but I think it should throw an assertion
and the documentation should be updated.

Thanks, Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100928/9cbb9728/attachment.html 

More information about the NumPy-Discussion mailing list