I'm attempting to read a .csv and write a new column. Whenever I call the function add(), the index error appears on Line 7.
def add():
data = pd.read_csv('log.csv')
for file in os.listdir('.'):
if 'log' in file:
continue
df = pd.read_csv(open(file))
val = data.loc[data['Num'] == file.split('.csv')[0], 'SAT'].iloc[0]
########more code using val#############
add()