def _switch(self, r, nr):
        for i, r_ in enumerate(r):
            if len(r) == i + 1 or r[i+1] != r_ + 1:
                # We are at the end of r, or there is a gap in r
                self._switch_at = r_
                break

            Sr = self.smoothedNr
            smooth_r_star = (r_ + 1) * Sr(r_+1) / Sr(r_)
            unsmooth_r_star = (r_ + 1) * nr[i+1] / nr[i]

            std = math.sqrt(self._variance(r_, nr[i], nr[i+1]))
            if abs(unsmooth_r_star-smooth_r_star) <= 1.96 * std:
                self._switch_at = r_
                break
Calculate a list of available zero rates
dataset/ETHPy150Open nltk/nltk/nltk/probability.py/SimpleGoodTuringProbDist._switch--crossover with--dataset/ETHPy150Open jamesmawm/Mastering-Python-for-Finance-source-codes/B03898_05_Codes/BootstrapYieldCurve.py/BootstrapYieldCurve.get_zero_rates