184. Department Highest Salary Question link Solution import pandas as pd def department_highest_salary(employee: pd.DataFrame, department: pd.DataFrame) -> pd.DataFrame: if employee.empty or department.empty: return pd.DataFrame(columns=['Department','Employee', 'Salary']) a=employee.merge(department, left_on='departmentId', right_on='id', suffixes=('_employee','_department')) b=a.groupby('departmentId').apply(lambda x:x[x['salary']==x['salary'].max()]) b=b.reset_index(drop=True) b=b[['name_department', 'name_employee', 'salary']] b.columns = ['Department','Employee', 'Salary'] return b