Is there anyway I can update remaining data frames in a dictionary after I update the first one?
For context I have multiple df in a dictionary and I'm running them one by one. I run them one by one using this pseudo code/process:
i = 1
y= 2
# Run an algorithm on the first df in the dictionary
output= dic[i].sort_values(by = ['TEAM', 'GROUP','SCORE'],
ascending = [False,False,True], ignore_index=True)
output= output['SCORE'] - 1
# Update the SCORE of the remaining dfs in the dictionary where GROUP is the same
#This code only updates the next df in the dictionary
dic[y] = dic[y].join(output.drop(columns=(['TEAM'])).set_index(['GROUP']),
on=['GROUP'], rsuffix='_NEW')
dic[y].loc[dic[y].SCORE_NEW.notna(), 'SCORE'] = dic[y].SCORE_NEW
dic[y] = dic[y].drop(columns='SCORE_NEW')
i+=1
y+=1
Any way that I can update all the remaining dfs on that dictionary instead of just the next one?