Reputation: 57
I have a np array with 1000 rows, and 4608 columns each rows
I try to save a csv file with:
myfile = open('dataset.csv', 'wb')
wr = csv.writer(myfile,delimiter='\n')
wr.writerow(Prueba[0])
But if I open the csv file with LibreOffice this:
[153 147 147 ..., 142 147 146]
[183 247 147 ..., 126 123 104]
...
No apears the 4608 columns!!
Some idea?
Thank you!
Regards, Andres.
Upvotes: 3
Views: 12795
Reputation: 2926
The type of the array
and the fmt
option must match. Try:
import numpy as np
np.savetxt('dataset.csv', array.astype(np.int), fmt='%d', delimiter=',')
where array
is your numpy array.
Upvotes: 1
Reputation: 662
Try this.
numpy.savetxt("FILENAME.csv", a, delimiter=",")
Where filename is your filename and a is your array.
Upvotes: 8