I am looking for the correct logic to combine two columns with related data from an .xlsx file using pandas in python. It is similar to the post: Merge 2 columns in pandas into one columns that have data in python, except that I also want to transform the data as I combine the columns so it's not really a true merge of the two columns. I want to be able to say "if column wbc_na has the value "checked" in row x, place "Not available" in row x under column wbc". Once combined, I want to drop the column" wbc_na" since "wbc" now contains all the information I need. For example:
input:
ID,wbc, wbc_na
1,9.0,-
2,NaN,checked
3,10.2,-
4,8.8,-
5,0,checked
output:
ID,wbc
1,9.0
2,Not available
3,10.2
4,8.8
5,Not available
Thanks for your suggestions.