Why doesn't this create a two-dimensional array?
>>> np.array((1,0,0), (0,1,0), (0,0,1), dtype=float)
What is the correct way?
To create a 2-dimensional array, array()
must be passed a sequence of sequences as a single argument: this call passes three sequence arguments instead. The correct call is
>>> np.array( ((1,0,0), (0,1,0), (0,0,1)) , dtype=float)