I have an array of some given size e.g 4x4 with all zeros,
a = np.zeros((4,4))
and I want to put 1 in each row at the column index given by another array
b = np.array([0,1,2,1])
so the resulted array should look like this,
a =
1 0 0 0
0 1 0 0
0 0 1 0
0 1 0 0
How can I do this for a large array of size (mxn) given b of size (mx1).
Thank You and Best Regards,