I have 4 columns in my pandas data frame with column names lets say, A,B,C,D each mapped to a field in UI. Each has its own purpose, however users are entering the field A information in either field A or B or C or D. I am trying to clean the data and bring it to column A for analysis. So if there is any value in column A, I don't care about values in B or C or D. But if there is no value in column A, then I have to look for user entry in other columns and bring it column A. Actual values for column A will always start with some values from our list. So, if there is no data in column A, then we have to look for the value in column B and see if that has the value from our list, then bring it to A, if column B is also null or if it has some other value than values from our list, leave it and check the same in column C, similarly in column D. How to do this in python?
Please let me know if anything is unclear.
Example,
mylist = ['senior','junior','midlevel']
inputdf
A B C D
senior male senior UK
senior candidate USA
female junior
junior male junior AU
male candidate midlevel
female candidate AU
Outputdf,
A B C D
senior male senior UK
senior senior candidate USA
junior female junior
junior male junior AU
midlevel male candidate midlevel
female candidate AU