Source Code:
(back to article)
import numpy as np # Creating a 2D array arr = np.array([[1, 2], [3, 4]]) # Try to set an element with a sequence try: arr[0][0] = [5, 6] except ValueError as e: print(e)
Result:
Report an issue