I am trying to iterate among two columns of a dataframe ("binS99", 'bin3HMax'). Those columns have values from 0 to 4. then I would like to create a new column ('Probability') in the same dataframe ("df_selection") taking the values from the matrix "Prob". The following code goes into a loop. any ideas on how to solve? thank you
prob = [[0, 0.00103, 0.00103],
[0, 0.00267, 0.00311],
[0, 0.00688, 0.01000],
[0, 0.01777, 0.03218]]
for index, row, in df_selection.iterrows():
a = int(df_selection.loc[index,"binS99"]) #int(str(row["binS99"]))
b = int(df_selection.loc[index,"bin3HMax"]) #int(str(row["bin3HMax"]))
df_selection.loc[index,"Probability"]= prob[a][b]
'''