So come scrivere il file txt usando numpy.savetxt()
ma non riesco a farlo scrivere il file usando solo numeri interi. Ho il seguente codice:Come scrivere un solo array 2D numpy su un file txt
new_picks = new_picks.astype(int)
np.savetxt(fname='newPicksData.txt', X=new_picks.astype(int))
Questo è come la matrice che sto ricevendo assomiglia:
2.900000000000000000e+01 3.290000000000000000e+02 1.000000000000000000e+00
4.300000000000000000e+01 1.080000000000000000e+02 1.000000000000000000e+00
4.300000000000000000e+01 1.950000000000000000e+02 1.000000000000000000e+00
5.600000000000000000e+01 1.510000000000000000e+02 1.000000000000000000e+00
5.600000000000000000e+01 9.700000000000000000e+01 1.000000000000000000e+00
7.000000000000000000e+01 2.840000000000000000e+02 1.000000000000000000e+00
3.500000000000000000e+01 3.170000000000000000e+02 1.000000000000000000e+00
5.400000000000000000e+01 2.110000000000000000e+02 1.000000000000000000e+00
6.400000000000000000e+01 1.180000000000000000e+02 1.000000000000000000e+00
5.400000000000000000e+01 3.700000000000000000e+01 1.000000000000000000e+00
1.300000000000000000e+01 1.950000000000000000e+02 1.000000000000000000e+00
1.300000000000000000e+01 1.680000000000000000e+02 1.000000000000000000e+00
1.300000000000000000e+01 2.780000000000000000e+02 1.000000000000000000e+00
4.900000000000000000e+01 2.200000000000000000e+01 1.000000000000000000e+00
4.900000000000000000e+01 1.040000000000000000e+02 1.000000000000000000e+00
4.900000000000000000e+01 7.500000000000000000e+01 1.000000000000000000e+00
5.400000000000000000e+01 2.610000000000000000e+02 1.000000000000000000e+00
5.400000000000000000e+01 2.600000000000000000e+02 1.000000000000000000e+00
5.400000000000000000e+01 1.150000000000000000e+02 1.000000000000000000e+00
5.400000000000000000e+01 5.400000000000000000e+01 1.000000000000000000e+00
1.300000000000000000e+01 5.400000000000000000e+01 1.000000000000000000e+00
4.900000000000000000e+01 5.400000000000000000e+01 1.000000000000000000e+00
Quello che sto cercando è qualcosa di simile:
29 329 1
43 108 1
43 195 1
56 151 1
56 97 1
basta aggiungere il parametro 'fmt ="% d "' –