Re: [Numpy-discussion] savetxt fmt argument fails when using a unicode string

2013-11-14 Thread Daπid
On 14 November 2013 09:25, Pierre Haessig wrote: > Le 13/11/2013 17:54, Daπid a écrit : > > > > np.savetxt('a.csv', [1], fmt=str('%.3f')) > Thanks, that's what I did too. > > I'm just still wondering whether there is a cleaner solution... > I have a fix, I am submitting a PR. The only thing I am

Re: [Numpy-discussion] savetxt fmt argument fails when using a unicode string

2013-11-14 Thread Pierre Haessig
Le 13/11/2013 17:54, Daπid a écrit : > > np.savetxt('a.csv', [1], fmt=str('%.3f')) Thanks, that's what I did too. I'm just still wondering whether there is a cleaner solution... > > Without the str, I get a clearer error: > ValueError: invalid fmt: u'%.3f' > Yeah, the commit by Warren Weckesser m

Re: [Numpy-discussion] savetxt fmt argument fails when using a unicode string

2013-11-13 Thread Daπid
The following works on Numpy 1.8.0: from __future__ import unicode_literals import numpy as np np.savetxt('a.csv', [1], fmt=str('%.3f')) Without the str, I get a clearer error: Traceback (most recent call last): File "a.py", line 4, in np.savetxt('a.csv', [1], fmt='%.3f') File ".virtu

[Numpy-discussion] savetxt fmt argument fails when using a unicode string

2013-11-13 Thread Pierre Haessig
Hi, I just noticed (with numpy 1.7.1) that the following code import numpy as np np.savetxt('a.csv', [1], fmt=u'%.3f') fails with: 1045 else: 1046 for row in X: -> 1047 fh.write(asbytes(format % tuple(row) + newline)) 1048 if len(footer) > 0: