I have a dataframe df
I want check each value in Age column and compare it with diff column and finally assign Yes, No or other to Is_dob column.
Age diff(DOB-today) Is_dob 54 54 Yes 27 27 Yes 43 44 No 68 70 No NA NA Other
I have tried below code:
for i, j in df['Age'].iteritems(): for k, m in df['diff'].iteritems() if pd.isnull(j) or pd.isnull(m): df['Is_dob']='other' elif(m==j): df['Is_dob']='Yes' else: df['Is_dob']='No'
But not getting expected output.
Can anyone suggest solution?
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.