Skip to content

Commit 5e59e9c

Browse files
committed
Use range over 0 <= for loops
1 parent e251587 commit 5e59e9c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pandas/_libs/lib.pyx

+9-9
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ def fast_unique_multiple(list arrays):
131131
dict table = {}
132132
object val, stub = 0
133133

134-
for i from 0 <= i < k:
134+
for i in range(k):
135135
buf = arrays[i]
136136
n = len(buf)
137-
for j from 0 <= j < n:
137+
for j in range(n):
138138
val = buf[j]
139139
if val not in table:
140140
table[val] = stub
@@ -158,10 +158,10 @@ def fast_unique_multiple_list(list lists):
158158
dict table = {}
159159
object val, stub = 0
160160

161-
for i from 0 <= i < k:
161+
for i in range(k):
162162
buf = lists[i]
163163
n = len(buf)
164-
for j from 0 <= j < n:
164+
for j in range(n):
165165
val = buf[j]
166166
if val not in table:
167167
table[val] = stub
@@ -200,7 +200,7 @@ def fast_unique_multiple_list_gen(object gen, bint sort=True):
200200

201201
for buf in gen:
202202
n = len(buf)
203-
for j from 0 <= j < n:
203+
for j in range(n):
204204
val = buf[j]
205205
if val not in table:
206206
table[val] = stub
@@ -830,15 +830,15 @@ def count_level_2d(ndarray[uint8_t, ndim=2, cast=True] mask,
830830
if axis == 0:
831831
counts = np.zeros((max_bin, k), dtype='i8')
832832
with nogil:
833-
for i from 0 <= i < n:
834-
for j from 0 <= j < k:
833+
for i in range(n):
834+
for j in range(n):
835835
counts[labels[i], j] += mask[i, j]
836836

837837
else: # axis == 1
838838
counts = np.zeros((n, max_bin), dtype='i8')
839839
with nogil:
840-
for i from 0 <= i < n:
841-
for j from 0 <= j < k:
840+
for i in range(n):
841+
for j in range(k):
842842
counts[i, labels[j]] += mask[i, j]
843843

844844
return counts

0 commit comments

Comments
 (0)