History table which will only run at the start of the process
data = [('A',len(A),t),('B',len(B),t),('C',len(C),t),('D',len(D),t),('E',len(E),t)] df = pd.DataFrame(data,columns=['Name','LENGTH','date']) df
This code will run everyday and will merge with the history table
import sched import time
scheduler = sched.scheduler(time.time, time.sleep)
def auto_table():
## History table which will only run at the start of the process data = [('A',len(A),t),('B',len(B),t),('C',len(C),t),('D',len(D),t),('E',len(E),t)] df = pd.DataFrame(data,columns=['Name','LENGTH','date']) df ## This code will run everyday and will merge with the history table import sched import time scheduler = sched.scheduler(time.time, time.sleep) def auto_table(): import datetime t= datetime.date.today()-datetime.timedelta(days=0) t data = [['A',len(A),t],['B',len(B),t],['C',len(C),t],['D',len(D),t], ['E',len(E),t]] df1 = pd.DataFrame(data,columns=['Name','LENGTH','date']) global df df=df.merge(df1,how='outer') return df print ('START:', time.time()) scheduler.enter(1, 1, auto_table()) scheduler.run() print ('START:', time.time()) scheduler.enter(1, 1, auto_table())
scheduler.run()
##II got this error START: 1547819432.8968043
TypeError Traceback (most recent call last) in () 22 scheduler.enter(1, 1, auto_table()) 23 ---> 24 scheduler.run()
C:\ProgramData\Anaconda3\lib\sched.py in run(self, blocking) 152 delayfunc(time - now) 153 else: --> 154 action(*argument, **kwargs) 155 delayfunc(0) # Let other threads run 156
TypeError: 'DataFrame' object is not callable
START: 1547819432.8968043 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-199-f7820889e2d5> in <module>() 22 scheduler.enter(1, 1, auto_table()) 23 ---> 24 scheduler.run() C:\ProgramData\Anaconda3\lib\sched.py in run(self, blocking) 152 delayfunc(time - now) 153 else: --> 154 action(*argument, **kwargs) 155 delayfunc(0) # Let other threads run 156 TypeError: 'DataFrame' object is not callable