Error cases
import numpy as np
X = np.array([0, 0], [0, 0], [1, 1])
- 1
- 2
Error message
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
- 1
- 2
- 3
- 4
- 5
- 6
Modify results
import numpy as np
# X = ([0, 0], [0, 0], [1, 1]) # Error
X = np.array([[0, 0], [0, 0], [1, 1]]) # correct
- 1
- 2
- 3