Re: building numpy arrays with regular structure

2016-12-17 Thread Peter Otten
Seb wrote: > 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]], >

building numpy arrays with regular structure

2016-12-16 Thread Seb
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],