,✅ 100% EASY || Only in 3 lines🔥|| keep it simple and clean🌟
Intuition\nThink about the top employees that have highiest salaries, not the max\n\n\n# Code\n\nimport pandas as pd\n\ndef department_highest_salary(employee: 
# Intuition\nThink about the top employees that have highiest salaries, not the max\n\n\n# Code\n```\nimport pandas as pd\n\ndef department_highest_salary(employee: pd.DataFrame, department: pd.DataFrame) -> pd.DataFrame:\n\n    # Find the top 1 highest salaries in each department using nlargest,\n    # keeping employees with the same salary using keep=\'all\'\n    # Use apply and lambda to maintain the DataFrame\'s shape\n    df_top1 = employee.groupby(\'departmentId\').apply(lambda x: x.nlargest(1, \'salary\', keep=\'all\')).reset_index(drop=True)\n\n    # Merge the result with the department DataFrame to get department names\n    df_joined = pd.merge(df_top1, department, left_on=\'departmentId\', right_on=\'id\', how=\'inner\', suffixes=(\'_employee\', \'_department\'))\n\n    # Rename columns for clarity\n    df_joined.rename(columns={"name_employee": "Employee", "name_department": "Department", "salary": "Salary"}, inplace=True)\n    \n    # Return a DataFrame with only the desired columns\n    return df_joined[["Department", "Employee", "Salary"]]\n\n```\n\n![image.png](https://assets.leetcode.com/users/images/a4eb271c-311b-4f9a-8f69-53ae7bdc4aad_1696795537.8373919.png)\n\n\n\n\n
['Pandas']