I have a 1D numpy array of specific values:
array_1 = [1.0, 3.0, 7.0, 9.0, 6.0]
These values can be found in a second 1D numpy array, at varying indices:
array_2 = [0.0, 1.0, 12.0, 16.0, 3.0, 7.0, 25.0, 9.0, 1.0, 4.0, 6.0]
I want to pull values from a third 1D numpy array, the same size as array_2, based on the location of the values given in array_1 in array_2:
array_3 = [123.6, 423.4, 12.4, 14.5, 25.6, 67.8, 423.5, 52.3, 32.4, 87.9, 78.1]
So, in the example above, because the values of array_1 are found in the following places in array_2: [0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1]
I therefore want to pull the values in those same indices from array_3. In other words, I want to be left with the following array_4:
array_4 = [423.4, 25.6, 67.8, 52.3, 78.1]
What's the best way to go about doing this?
1.0appears twice inarray_2. Is it intentional?