简体   繁体   中英

How to save np.append become column just like this pic

fitur.append(meanList)
fitur.append(rata_rataList)
np.savetxt('variance/fitur.csv',fitur, newline='n')

my values written into rows, but i want to write into CSV in table form, i want:

MeanList  rata_rataList
value 1| value 2
value a| value b

thank you!

you can use to save your data in CSV or excel.xlsx if you want:

fitur.append(meanList)
fitur.append(rata_rataList)
fitur.to_csv('name_of_excel.csv')

OR

fitur.append(meanList)
fitur.append(rata_rataList)
fitur.to_excel('name_of_excel.xlsx')

You can specify delimiter and header :

np.savetxt('variance/fitur.csv',fitur,header='meanList {:^2s}'.format('rata_rataList'),delimiter="|")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM