I want to replace the values in the column 'Risk Rating' if and only if three conditions are met from three different columns of the dataframe. I did it using mask technique and also by .loc method but it did not work for me. I want to do this for 9 rows only. I want to replace the 'Risk Rating' value from 0 to 9 for this singular case. The length of the dataframe is 180002. Here is the code that I wrote:
safety.loc[((safety['Employee Name']=="Shabbir Hussain") & (safety['Employee Number']==11231) &
(safety['Attendance Date']=="2020-03-12")),['Risk Rating']]=9
mask = (safety['Employee Name']=="Shakir Hussain") & (safety['Employee Number']==11026) &
(safety['Attendance Date']=="2020-03-12") & (safety['Risk Rating']==0)
safety['Risk Rating'][mask]=9