Reputation: 47
How to update the records based on the multiple condition
I have dataframe with below columns
Married
Applicant income
Co-applicant income
I want to update the nan field in married by checking the Applicant income greater than 0 and Co-applicant income greater than 0
Upvotes: 1
Views: 42
Reputation: 353
Can you try with this.
condition=(df['ApplicantIncome']>0)&(df['CoapplicantIncome'] >0 )
condition2=(df['Married'].isnull())
criteria = condition & condition2
df.loc[criteria,'Married']='Yes'
Upvotes: 2