Home > Software design >  How to replace value in pandas with value in the same row but in a different column
How to replace value in pandas with value in the same row but in a different column

Time:07-18

I have this dataframe. I want to replace all the 'DEBIT' values in the 'Payee' column to their corresponding value in the 'Memo' column.

e.g. the first DEBIT value should be replaced with 'FC02-0224-0185673-83 mom ball tickets' and so on and so forth.

I have experimented with some replace and mask functions to no avail.

Any ideas on how to do this with syntax examples would be greatly appreciated.

CodePudding user response:

Try this

df.Payee[df.Payee == 'DEBIT'] = df.Memo
  • Related