race_id = test_df['Name']
test_df['One_winner'] = 0
highest_prob = test_df.sort_values('KerasShap').drop_duplicates('Name', keep='last')
highest_prob['One_winner'] = 1
index_list = list(highest_prob.index)
lowest_prob = test_df.drop(index = index_list)
one_winner = pd.concat([lowest_prob, highest_prob], axis =0, join='inner').sort_values('Name').reset_index()
So df['Name'] is the name of the races in my dataset. KerasShap has probability I want to put "1" on the highest probality per race.
Code runs but doesn't do what I intended!
Does not update One_winner to 1 at all.
Any help welcome