Column A | Column B |
---|---|
Police | 1 |
other | 0 |
Ambulance | 0 |
Police | 1 |
other | 0 |
Ambulance | 1 |
Police | 1 |
other | 1 |
Ambulance | 1 |
Data entry error was detected in the data and I am required to correct it. If for any claim transaction “Column A” is NOT “Police” and Column B == 1 Then Update “Column A” to Police. Wherever I have "1" in "Column_B' I want the value "Column A" in Police
I tried this command
df.loc[(df['Column_A'] !="Police") & (df['Column_B']==1)]
From this command I'm only getting the dataframe but I want to replace the value to police in the same dataset without adding any new column or variable. I want to acheive this
Column A | Column B |
---|---|
Police | 1 |
other | 0 |
Ambulance | 0 |
Police | 1 |
other | 0 |
Police | 1 |
Police | 1 |
Police | 1 |
Police | 1 |