this is my code
import numpy
a = numpy.asarray([ [1,2,3,4],[5,6],[7,8,9,10] ])
numpy.savetxt("a.csv", a, fmt="%d", delimiter=",")
I run it, but it report error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numpy/lib/npyio.py", line 1422, in savetxt
v = format % tuple(row) + newline
TypeError: %d format: a number is required, not list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/Desktop/csvTest.py", line 3, in <module>
numpy.savetxt("foo.csv", a,fmt="%d", delimiter=",")
File "/usr/lib/python3/dist-packages/numpy/lib/npyio.py", line 1426, in savetxt
% (str(X.dtype), format))
TypeError: Mismatch between array dtype ('object') and format specifier ('%d')
after i try this code
import numpy
a = numpy.asarray([ [1,2,3],[4,5,6],[7,8,9] ])
numpy.savetxt("a.csv", a, fmt="%d", delimiter=",")
it can work, so how do i to solve this problem? can i save different array length with csv?