Reputation: 19
I have a dataset from which i need to take the index 0 and 1 then process the output then take the index value 2 and 3 then process the output and so on.
The code which i have tried takes the value of index 0 and 1 then 1 and 2 then 2 and 3 and so on.
for i,r in tqdm(gf.iterrows()):
lp = 0
for v in range(0, 10 + 1):
lp += r.length_10
ix.append(i)
basket.append(r.line.interpolate(lp))
The code must take the index value of o and 1 then 2 and 3 then 4 and 5 and so on....0
Upvotes: 0
Views: 62
Reputation: 1115
for v in range(0, 10+1,2):
print(v,v+1)
#prints
#0 1
#2 3
#4 5
#6 7
#8 9
Upvotes: 1
Reputation: 11
Honestly, I couldn't understand very well your code. But, I think that the problem occurs here:
for v in range(0, 10 + 1):
this means that your iterator will go from 0 to 10 one by one, but try to change this line to:
for v in range(0, 10 + 1,2):
I think this one will do the job
Upvotes: 0