Not fast, but simple
Code\n\nimport pandas as pd\n\ndef department_highest_salary(employee: pd.DataFrame, department: pd.DataFrame) -> pd.DataFrame:\n#Find max salary in every depar
# Code\n```\nimport pandas as pd\n\ndef department_highest_salary(employee: pd.DataFrame, department: pd.DataFrame) -> pd.DataFrame:\n#Find max salary in every department\n    high_dep = employee.groupby([\'departmentId\']).agg(max).reset_index()\n# Add employees who have these salaries in each department\n    employee = employee.merge(high_dep, left_on=[\'departmentId\',\'salary\'], right_on=[\'departmentId\',\'salary\'], how=\'left\').dropna()[[\'name_x\',\'salary\',\'departmentId\']]\n#connect the necessary columns with the department name, rename them, output the necessary columns\n    res = employee.merge(department, left_on=\'departmentId\', right_on=\'id\', how=\'inner\').rename({\'name\': \'Department\', \'name_x\' : \'Employee\', \'salary\' : \'Salary\'}, axis=1)[[\'Department\',\'Employee\',\'Salary\']]\n    return res\n```\nMe while writing solution:\n![photo_2023-11-26_20-20-32.jpg](https://assets.leetcode.com/users/images/2475a99c-7055-4638-a32e-1273b885c174_1701699152.4880462.jpeg)\n
['Pandas']