# How to write formula inside the loop to run this code in every hour continously in every day in panda python

I have a csv file with five column data value.

five columns are ['A','B','C','D','time']

Here my 'D' column is the output column and 'A'is my first column.

Here I upload my coda and csv file.

data = pd.read_csv('data20.csv')
data = pd.DataFrame(data,columns=['time', 'A','B','C','D'])
for i in range(1, len(data)):
data.loc[i+1,'A'] = data.loc[i, 'D'] + data.loc[i, 'B'] - data.loc[i, 'C']


my csv file ; In my csv first row in A column 63 is represented and my output is 63 in D column. D column is my desired outputs. then in second row in A column its represented as 0. but I want to apply previous output value(63) into second row as A column input. Then that value will calculate by column B and reduce by C column then my desired output value is 60 represent in D column. So like this process will continue. So in A column 0 values replace by previous output value in D column.

Here I want to call that every hour this process continue. In my csv file till to 2 p.m output value is 72.

So then this 72 is will be the input of A column at 3p.m.then B and C column values will calculate or reduce using this formula will give the output for at 3.00 p.m.

So like this I want to find the value of D column at 4p.m, 5 p.m, 6 p.m till to 12 midnight and it will continous to next day. So I wrote the code and I ddn't have any idea to give time for this process. Can anyone help me to solve this problem?

you could do something like

import time
while True:

• That's the point of the code, the line time.sleep(3600) pauses your code for 3600 seconds, I thought that's what you were looking for. – Robin Nicole Dec 11 '18 at 10:59