Hello,

Is there an easier way to write a numpy array with a regular structure?
For example, an array with [0, 1] along the diagnal of one of the array
dimensions, and zero elsewhere:

zz = np.array([[[0, 1], [0, 0], [0, 0]],
               [[0, 0], [0, 1], [0, 0]],
               [[0, 0], [0, 0], [0, 1]]])

This one is not so big, but if it were, there must be a way to code this
properly.

Thanks,

-- 
Seb

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to