So, I have a python code like this:
import csv
import pandas as pd
import numpy as np
import time
from pandas import Series,DataFrame
df = pd.read_csv('C:/Users/Desktop/case_study_1.csv',low_memory=False)
df.head()
#convert interaction_time to date time format
df.interaction_time = pd.to_datetime(df.interaction_time)
#remove null on merchant column
df_remove_null = df.dropna(subset=['merchant'])
#count added, comfirmed txn
df_cnt = df_remove_null.groupby([pd.Grouper(key='interaction_time',freq='H'),df_remove_null.fullVisitorid,df_remove_null.action_type]).size().reset_index(name='count')
df_final_cnt = df_cnt.groupby(['interaction_time','action_type'])['fullVisitorid'].size().reset_index(name='count')
#export csv file
df_final_cnt.to_csv(r'C:\Users\Desktop\filename12.csv',index = False, columns = ["interaction_time","action_type","count"])
As you can see, the code outputs a csv file. I saved the csv file to my local directory. All I want to do is just to run the code automatically every 10mins and generate a new csv file. So, every 10mins the new csv file will overwrite the old one.
I dont have much knowledge about automation so any kind of help will be greatly appreciated.
I tried for loop with range(100) but the error show: IndentationError: expected an indented block
Thanks.