Numpy load TypeError: Mismatch b

2020-02-15  本文已影响0人  在努力的Jie

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

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

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

正确代码:

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

猜你喜欢

热点阅读