employees has columns employee_id, department and salary, where
some salaries are missing.
Replace each missing salary with the median salary of that employee's department, computed from the rows that do have one. A department where nobody has a salary stays missing. Return the original columns with the index unchanged.
Input
employee_id department salary
0 1 Eng 100.0
1 2 Eng NaN
2 3 Eng 140.0
3 4 Ops NaN
4 5 Ops NaN
Output
employee_id department salary
0 1 Eng 100.0
1 2 Eng 120.0
2 3 Eng 140.0
3 4 Ops NaN
4 5 Ops NaN