code: def count_above(errors, epsilon):
      
      above = errors > epsilon
      total_above = len(errors[above])
  
      above = pd.Series(above)
      shift = above.shift(1)
      change = above != shift
  
      total_consecutive = sum(above & change)
  
      return total_above, total_consecutive
docs: Count number of errors and continuous sequences above epsilon.
  
      Continuous sequences are counted by shifting and counting the number
      of positions where there was a change and the original value was true,
      which means that a sequence started at that position.