Fill each missing salary with the mean salary of its department (departments with no known salary stay missing). Store the Series in result.
import pandas as pd
import numpy as np
df = pd.DataFrame({
"dept": ["Eng", "Eng", "Eng", "Sales", "Sales", "HR"],
"salary": [100.0, np.nan, 140.0, 60.0, np.nan, np.nan],
})Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.