numpy.core._exceptions.ufunctypeyperor:ufunc' add'不包含具有签名匹配类型的循环(dtype('< u20'),dtype(' int64; int64')) - >没有皮顿
每当我尝试在下面运行此代码时,我都会遇到错误:
numpy.core._exceptions.ifunctypeypeerror:ufunc'Add'不包含具有签名匹配类型(dtype('< u20'),dtype('int64'))的循环 - >没有
IM试图在名称uploaded_numbers
下打开.data
文件,然后覆盖以前与我拥有的新数据编号一起使用的文件。我知道阅读和写作部分在程序后面使用时起作用,并且它运行得很好。
有帮助吗?
import numpy as np
import pickle
with open(r'W:\Python\NEA Dice Project\account_number.data', 'rb') as x:
uploaded_numbers = pickle.load(x)
print(uploaded_numbers)
uploaded_numbers += 1
with open(r'W:\Python\NEA Dice Project\account_number.data', 'wb') as x:
pickle.dump(uploaded_numbers, x)
Whenever I try to run this code below, I am met with the the error:
numpy.core._exceptions.UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U20'), dtype('int64')) -> None
Im trying to open a .data
file under the name uploaded_numbers
and then overwrite the file that it was previously on with the new data number I have. I know the reading and the writing part works as I use it later in the program and it works perfectly.
Any help?
import numpy as np
import pickle
with open(r'W:\Python\NEA Dice Project\account_number.data', 'rb') as x:
uploaded_numbers = pickle.load(x)
print(uploaded_numbers)
uploaded_numbers += 1
with open(r'W:\Python\NEA Dice Project\account_number.data', 'wb') as x:
pickle.dump(uploaded_numbers, x)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您写道:
我认为您可能忘记了“ X”参数。
除此之外,恐怕我们没有太多帮助...
从提供的代码中,没有明确的使用Numpy,我们真的不知道您的
.data
文件中的内容,只有一行由您的错误触发。 ..我希望我能够在您的问题下的评论部分中写这篇文章,但是我不允许这样做...
You wrote :
I think you probably forgot the 'x' parameter.
Aside from that, I'm afraid there isn't much help we can offer...
From the bit of code provided, there is no explicit use of numpy, we don't really know what's in your
.data
files, and only one line of the full trace-back triggered by your error...I wish I was able to write this in the comment section under your question, but I am not allowed to do so...