I have this dataframe that houses job details and there are columns for Pay, location, Job position, Job Description, other information, Etc.
However sometimes the values in pay might not be present and is available in location for example.
I want to be able to loop through the column in location and update the values in pay but if there is data in pay I want to retain it, only updating the values from location instead.
My first thought is using apply lambda like so but I am unable to put in the else condition that would just allow me to retain the value of pay if location is blank
df['Pay'] = df['Location'].apply(lambda x : x if x !='' else [retain the value of Pay] )
What am I doing wrong?
Thank you for reading