How would one remove n
elements from 2D
numpy array where n
varies in each row?
For example:
# input array
[[1,2,3],
[3,1,2],
[1,2,3],
[4,5,2],
[5,6,7]]
with
# n elements to remove from each row
[0, 2, 1, 2, 1]
would result in:
[[1,2,3],
[3],
[1, 2],
[4],
[5,6]]
Do note that the result does not need to be a numpy array(and won't be as Michael noticed in the comments), just an arbitrary Python list of lists.