I am trying to use numpy.savetxt to dump data in to varieties of format for each column.
when data is
data = np.array([[1.111, 2.222, 3.333],
[4.444, 5.555, 6.666],
[7.777, 8.888, 9.999] ])
np.savetxt('data.txt', data,
fmt= ['%i', '%.2f', '%s'], ## <== 1st column, int, 2nd float, 3rd string
delimiter = ',')
everything works fine. But when data is:
data = np.array([[1.111, 2.222, 'three'],
[4.444, 5.555, 'six'],
[7.777, 8.888, 'nine'] ])
np.savetxt('data.txt', data,
fmt= ['%i', '%.2f', '%s'], ## <== 1st column, int, 2nd float, 3rd string
delimiter = ',')
it gives me a error that: fh.write(asbytes(format % tuple(row) + newline)) TypeError: %d format: a number is required, not numpy.string_
Anybody have a clue?