Faster way to compute index of half life value : I want to find the index of the half-life value of an array. 

Is there a built-in function or faster way to compute the following?   


    x = np.array([67, 51, 42, 37, 21, 10, 2, 2, 1, 1, 1])
    
    def half_life_idx(x):
        middle = sum(x) / 2
        for idx, val in enumerate(x):
            middle = middle - val 
            if middle <= 0:         
                break
                
        return idx
    
    half_life_idx(x)

    >> 1



