It doesn't give you the exact answer directly, but I think it is easier to understand. You can compare each value to the one before it to see whether they are equal.
import numpy as np
arr = np.array(['horse', 'horse', 'horse', 'deer', 'deer', 'horse', 'cat', 'deer'])
print( arr[1:] )
# ['horse' 'horse' 'deer' 'deer' 'horse' 'cat' 'deer']
print( arr[:-1] )
# ['horse' 'horse' 'horse' 'deer' 'deer' 'horse' 'cat']
print( arr[1:] != arr[:-1] )
# [False False True False True True True]
and you can get the indexes by using nonzero().
out = (arr[1:] != arr[:-1]).nonzero()[0] + 1
print( out )
# [3 5 6 7]
To get the exact answer, you can insert the 0 to the start as it is always going to be there.
answer = np.insert(out,0,0)
print( answer )
# [0 3 5 6 7]