##// END OF EJS Templates
remove six usage (unnecessary starting python 2.6)
stonebig <stonebig> -
Show More
@@ -20,7 +20,6 b' from __future__ import division, with_statement'
20 20
21 21 import numpy as np
22 22 from matplotlib import pyplot as plt
23 from six import advance_iterator
24 23
25 24 # Top-level functions
26 25
@@ -100,8 +99,8 b' def two_digit_freqs(digits, normalize=False):'
100 99 Consume digits of pi and compute 2 digits freq. counts.
101 100 """
102 101 freqs = np.zeros(100, dtype='i4')
103 last = advance_iterator(digits)
104 this = advance_iterator(digits)
102 last = next(digits)
103 this = next(digits)
105 104 for d in digits:
106 105 index = int(last + this)
107 106 freqs[index] += 1
@@ -120,7 +119,7 b' def n_digit_freqs(digits, n, normalize=False):'
120 119 freqs = np.zeros(pow(10,n), dtype='i4')
121 120 current = np.zeros(n, dtype=int)
122 121 for i in range(n):
123 current[i] = advance_iterator(digits)
122 current[i] = next(digits)
124 123 for d in digits:
125 124 index = int(''.join(map(str, current)))
126 125 freqs[index] += 1
General Comments 0
You need to be logged in to leave comments. Login now