__array__() takes 1 positional argument but 2 were given
时间: 2023-10-31 11:36:09 浏览: 73
This error message indicates that you have passed two arguments to a function or method that only takes one argument.
For example, if you have a numpy array object and you try to call the `__array__()` method with two arguments, you will get this error message. The `__array__()` method only takes one argument, which is the dtype of the returned array.
To fix this error, make sure you are only passing one argument to the function or method that you are calling. If you are unsure of the correct number of arguments, consult the documentation or source code for the function or method.
相关问题
TypeError: __array__() takes 1 positional argument but 2 were given
这个错误通常是由于在调用__array__()方法时传递了多个参数而导致的。__array__()方法是用于将对象转换为数组的方法,它只接受一个参数,即表示数组类型的对象。如果传递了多个参数,则会引发TypeError异常。
解决方案:
1.检查代码中是否有多余的参数传递给了__array__()方法。
2.检查传递给__array__()方法的参数是否正确。
3.检查代码中是否存在其他错误,例如拼写错误或语法错误。
TypeError: TypeError: get_heavy() takes 1 positional argument but 2000 were givenget_heavy() takes 1 positional argument but 74 were given
这个错误提示表明你调用了一个名为 get_heavy() 的函数,但是你传入的参数数量不正确。具体来说,这个函数只接受一个参数,但是你传入了 2000 个或者 74 个参数。这可能是因为你在调用函数时传入了错误的参数或者函数定义本身有问题。
如果你能提供更多的上下文信息,比如函数定义和调用代码,我可以更好地帮助你解决这个问题。
阅读全文