🔥💯Very Simple and clean Pandas  (With Comments) 🔥💯
\n# Approach\n- Drop any duplicate salary values: Use the drop_duplicates() function on the \'salary\' column to remove any duplicate salary values, if present.
\n# Approach\n- Drop any duplicate salary values: Use the drop_duplicates() function on the \'salary\' column to remove any duplicate salary values, if present. This step is essential to avoid counting duplicates as separate salary ranks.\n\n- Sort the unique salaries: Use the sort_values() function on the unique salary values to sort them in descending order.\n\n- Check if N is within the valid range: Verify if the desired Nth highest salary is within the range of unique salary values available in the DataFrame. If N exceeds the number of unique salaries, there is no Nth highest salary, and we return \'None\'.\n\n- Get the Nth highest salary: Use iloc[N - 1] to access the Nth highest salary from the sorted salaries. Subtract 1 from N because Python uses zero-based indexing\n# Code\n```\nimport pandas as pd\n\ndef nth_highest_salary(employee: pd.DataFrame, N: int) -> pd.DataFrame:\n\n    # Drop any duplicate salary values to avoid counting duplicates as separate salary ranks\n    unique_salaries = employee[\'salary\'].drop_duplicates()\n\n    # Sort the unique salaries in descending order and get the Nth highest salary\n    sorted_salaries = unique_salaries.sort_values(ascending=False)\n\n    # If N exceeds the number of unique salaries, return None\n    if N > len(sorted_salaries):\n        return pd.DataFrame({\'Nth Highest Salary\': [None]})\n    \n    # Get the Nth highest salary from the sorted salaries\n    nth_highest = sorted_salaries.iloc[N - 1]\n    \n    return pd.DataFrame({\'Nth Highest Salary\': [nth_highest]})\n```\n![upvote img.jpg](https://assets.leetcode.com/users/images/22d7c772-e447-4bec-a23a-69a2c2f5f1e0_1691069745.712749.jpeg)\n
['Pandas']