environment/share/doc/ipython/examples/parallel/pi/pidigits.py
def two_digit_freqs(digits, normalize=False):
    """
    Consume digits of pi and compute 2 digits freq. counts.
    """
    freqs = np.zeros(100, dtype='i4')
    last = digits.next()
    this = digits.next()
    for d in digits:
        index = int(last + this)
        freqs[index] += 1
        last = this
        this = d
    if normalize:
        freqs = freqs/freqs.sum()
    return freqs
def two_digit_freqs(digits, normalize=False):
    """
    Consume digits of pi and compute 2 digits freq. counts.
    """
    freqs = np.zeros(100, dtype='i4')
    last = digits.next()
    this = digits.next()
    for d in digits:
        index = int(last + this)
        freqs[index] += 1
        last = this
        this = d
    if normalize:
        freqs = freqs/freqs.sum()
    return freqs
def two_digit_freqs ( digits , normalize = False ) : freqs = np . zeros ( 100 , dtype = 'i4' ) last = digits . next ( ) this = digits . next ( ) for d in digits : index = int ( last + this ) freqs [ index ] += 1 last = this this = d if normalize : freqs = freqs / freqs . sum ( ) return freqs
Consume digits of pi and compute 2 digits freq. counts.
Consume digits of pi and compute 2 digits freq . counts .