I have two array s
x=array([[0, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[2, 2, 2, 2, 2]])
I want to subselect elements in each row by the length in array y
y = array([3, 2, 4])
My target is z:
z = array([[0, 0, 0],
[1, 0,],
[2, 2, 2, 2]])
How could I do that with numpy functions instead of list/loop?
Thank you so much for your help.
np.splitand discard every other bit.