1

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.

5
  • 1
    images of data/code are not acceptable, please provide reproducible text Commented Jul 18, 2022 at 8:55
  • try this df.Payee[df.Payee == 'DEBIT'] = df.Memo Commented Jul 18, 2022 at 8:58
  • 1
    Please post your question in pure text form: why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question Commented Jul 18, 2022 at 8:59
  • @mozway My code is not reproducible as the dataframe is based on an uploaded CSV file, and so it will change everytime. I just need a way of replacing every DEBIT value that exists with the value in the Memo column in the same row. Commented Jul 18, 2022 at 8:59
  • @BerlinBenilo Sorry, I don't think I can do that as I do not have enough reputation. If you post it as an answer I will gladly mark it correct. Thank you for your help. Commented Jul 18, 2022 at 9:05

1 Answer 1

1

Try this

df.Payee[df.Payee == 'DEBIT'] = df.Memo
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.