TypeError: array() takes from 1 to 2 positional arguments but 3 were given

错误案例

import numpy as np
X = np.array([0, 0], [0, 0], [1, 1])

错误提示

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_52444/1027577749.py in <module>
      1 import numpy as np
----> 2 X = np.array([0, 0], [0, 0], [1, 1])

TypeError: array() takes from 1 to 2 positional arguments but 3 were given

修改结果

import numpy as np
# X = np.array([0, 0], [0, 0], [1, 1])     # 错误
X = np.array([[0, 0], [0, 0], [1, 1]])     # 正确

你可能感兴趣的:(Python报错集合,#,TypeError,python,numpy,测试,数组)