I want to fill missing value base on other columns in pandas. Here is my table:
Gender Married
Male Yes
Male Yes
Female No
Female No
Male NaN
Female NaN
I to fill missing value of Married field by if Gender is Male -> Married is Yes, else Married is No:
df['Married'].fillna(df[df['Married'].isnull()].apply(lambda x: 'Yes' if (df[df['Married'].isnull()]['Gender'] is 'Male') else 'No', axis=1), inplace=True)
But it was fail, I try a lot of way and I get nothing as my expectation. I hope receive from all of you.