You need a 2D array, the 0 axis is the row, and the 1 axis is the column. Therefore, I use z[None, :]to convert it to a 2D array:
from StringIO import StringIO
s = StringIO()
z = np.array([1,2,3])
np.savetxt(s,z[None, :],delimiter='hi')
s.getvalue()
output:
1.000000000000000000e+00hi2.000000000000000000e+00hi3.000000000000000000e+00\n
source
share