Skip to content Skip to sidebar Skip to footer

Numpy Savetxt Fails When Using File Handler

On windows 7, with the newest numpy 1.13.3 and PYTHON 3.5, if I have an array called points, with shape m x 6 and dtype of float32. I can save the array to a 'foo.txt' file as belo

Solution 1:

This behaviour only happens with Python 3, and depends on the version of numpy.

With older versions of numpy (before 1.14.0) the file must be opened with wb mode to write bytes with savetxt.

With numpy 1.14.0 or later, this issue is resolved. The example in the question works as expected.

Post a Comment for "Numpy Savetxt Fails When Using File Handler"