I have created a sort of matrix/data-table in python from multiple arrays containing various kinds of data, which looks like this in the variable view:
phones starts mids
sil 308000.0 308195.0
DH 308390.0 308410.0
AH0 308430.0 308445.0
B 308460.0 308525.0
These are three lists that I have combined using numpy.columnstack(). I am trying to output this table/matrix in the same format/structure but as a csv using numpy.savetxt. Is this possible given the different variable types in each row/column?
When I try to run :
np.savetxt('blue.txt', np.column_stack((phones, phone_starts, phone_mids)), ',', fmt="%s %f")
I get the error:
File "<__array_function__ internals>", line 4, in savetxt
TypeError: _savetxt_dispatcher() got multiple values for argument 'fmt'
I have also tried without the 'fmt' option and have gotten a similar error.
Any ideas?
column_stack. What is itsdtypeandshape? My guess it is 2d with a stringdtype. (with 3 columns). In which case, I'd tryfmt='%s',savetxtwrites afmt % tuple(row)for each row of the array.savetxtisfilename, X, fmt, delimiter, .... Usedelimiter=',', fmt='%s'.