One - One Code All

Blog Content

python之numpy保存数据为csv,np.savetxt,np.loadtxt

Python   2013-03-02 21:57:46

numpy保存和读取数据


1.csv ==> ndarray

import numpy

arr = numpy.loadtxt(filepath, delimiter=",", skiprows=0)  # skiprows=0 跳过0行,1即跳过第一行。


2. ndarray ==> csv

import numpy

numpy.savetxt(filepath, arr, delimiter=',')



上一篇:Python rpartition() 方法
下一篇:通过pandas.to_csv将numpy数组保存到csv

The minute you think of giving up, think of the reason why you held on so long.