美文网首页
Numpy load TypeError: Mismatch b

Numpy load TypeError: Mismatch b

作者: 在努力的Jie | 来源:发表于2020-02-15 14:44 被阅读0次

报错信息:TypeError: Mismatch between array dtype ('<U45') and format specifier ('%.18e')
原代码:

np.savetxt('wordword.txt',vocab)
np.savetxt('wordvectors.txt',embd)

参考文档
解决办法:对格式进行指定就好了

  • np.savetxt(‘foo.csv’, fmt = ‘%s’)

正确代码:

np.savetxt('wordword.txt',vocab,fmt ='%s')
np.savetxt('wordvectors.txt',embd,fmt ='%s')

相关文章

网友评论

      本文标题:Numpy load TypeError: Mismatch b

      本文链接:https://www.haomeiwen.com/subject/yiaefhtx.html