Python中保存和读取numpy array类型变量
保存:
import numpy as np
predict_label = np.array([0,1,0,1])
np.save('predict_label.npy',predict_label)
拓展:如果想在matlab中加载数据,则保持为mat格式数据
from scipy import io
io.savemat('predict_label.mat',{'predict_label':predict_label})
读取
import numpy as np
predict_label = np.load('predict_label.npy')
参考: