I'm using python 2.7.13, and I'm perplexed by a behavior that I'm seeing when using array slicing with numpy.
import numpy as np
a=np.array([1,1,2,3,4,5,6,7])
print a
print a[1:]
print a[1:] > 3
print np.where( a[1:] > 1 )
I was expecting that I would see for the final output [2 3 4 5 6 7 8] i.e. the indices of the array that were found within the slice.
My goal was to apply the Boolean mask to all elements of the array except the first element. Then to grab value in the array that corresponded to the first 'True' value in the index array. Is this possible?
wherejust tells you wherea[1:]>1isTrue. It does nothing witha.