我想将数据导出到一个CSV文件,但输出结果与我想要的不同
word = "contoh"
vector = np.array([-0.6910377 , 1.6553369 , 0.6142262 , 2.7324615 , -0.29642856])
list=(word,vector)
print(list)
print(len(vector))
ok=open('samp.csv','a')
a=csv.writer(ok)
a.writerows(list)
此代码的输出
c,o,n,t,o,h
-0.6910377 , 1.6553369 , 0.6142262 , 2.7324615 , -0.29642856....
我想要这样的输出
contoh,-0.6910377 , 1.6553369 , 0.6142262 , 2.7324615 , -0.29642856...
我希望contoh和数字数组在一行中
请帮帮我
这就是您想要实现的,向
numpy
array
添加一个单词,然后将其另存为csv
文件。你知道吗见下面的模型。让我知道它是否有效。你知道吗
结果如下(在
samp.csv
):相关问题 更多 >
编程相关推荐