Utilisez ILOC pour parcourir DataFrame
vals = [] # Create an empty list to hold the requested values
for i in range(len(df['loc'])): # Loop over the rows ('i')
val = df.iloc[i, df['loc'][i]] # Get the requested value from row 'i'
vals.append(val) # append value to list 'vals'
df['value'] = vals # Add list 'vals' as a new column to the DataFrame
Silly Swiftlet