fastest way to create numpy 2d array of indices

Viewed 5813

I want to create a numpy 2d array containning the cells indices, for example such 2x2 mat can be created using :

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

In other words cell at index i,j should contain the list [i,j].

I could make a nested loop to do it c way but i am wondering if there is a fast pythonic way to do that?

3 Answers
Related