I tried to do this in python, but I get an error:
import numpy as np
array_to_filter = np.array([1,2,3,4,5])
equal_array = np.array([1,2,5,5,5])
array_to_filter[equal_array]
and this leads to:
IndexError: index 5 is out of bounds for axis 0 with size 5
What gives? I thought I was doing the right operation here.
I expect if I do
array_to_filter[equal_array]
So that he returns
np.array([1,2,5])
If I'm not on the right track, how would I do it?
source
share