I have a dataframe where Income column have missing values, and I want to replace these missing values with the average of the income based on their education type.
I have already calculated the average income according to education level, but I have no idea how I am gonna replace null values with these averages!!
Here is the average income according to edu:
income_edu_based = df.groupby("Education")["Income"].mean().apply(lambda x: round(x,2))
Education
2n Cycle 47633.19
Basic 20306.26
Graduation 52720.37
Master 52917.53
PhD 56145.31
Name: Income, dtype: float64
I want to replace null values with above values but according to its education level!!!