Saving arrays as columns with np.savetxt

后端 未结 4 1869
Happy的楠姐
Happy的楠姐 2021-01-29 22:16

I am trying to do something that is probable very simple. I would like to save three arrays to a file as columns using \'np.savetxt\' When I try this

x = [1,2,3         


        
4条回答
  •  感动是毒
    2021-01-29 22:41

    I find numpy.column_stack() most intuitive:

    np.savetxt('myfile.txt', np.column_stack([x,y,z]))
    

提交回复
热议问题