Say I have an array that looks like the following:
arr = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
And I have another array slicer = [1,3,2]. I want to apply these values as the slice index over axis 0 measure along axis 1.
This doesn't work (and in fact contains no way of specifying that the along part is axis 1 in an ndarray) but suppose I tried arr[:slicer, :]
I would hope to obtain,
out = [[1, 2, 3],
[nan, 5, 6],
[nan, 8, nan]]
which is the combination of applying the slice arr[:1, :], arr[:3, :], arr[:2, :] and then selecting from those the 1st, 2nd and 3rd columns respectively and reassembling into the array above, dropping missing values.
I want to avoid loops and trying to find a fast vectorised solution