Skip to content
Advertisement

why does nested loop start from 0 and how to change it to start from where it had left?

I want to generate a code that will write 20 rows from each of two different dataframes. Therefore, I created something like below. Everything works fine except nested loop (u) starts from 0 each time. Can you help me how to fix it to start from where it left, please?

JavaScript

Advertisement

Answer

Do you want to alternate between the two tables? Then I would just access the content by index:

JavaScript

Edit: to get line 0-19 from table 1, then 0-19 from table 2, then 20-39 from table one etc:

(based on the answer of im_vutu but making sure all lines are copied, even if the total is not divisible by 20)

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement