Creating a NumPy array #1

Question Q6.1.2

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?


Solution

To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.