I want to find index of the nearest transition in a numpy ndarray of integers given a current index in an efficient manner. Transition means a change of value.
For e