swap salary
Intuition\n Describe your first thoughts on how to solve this problem. \nSwap \'m\' and \'f\' values using a single update statement\n# Approach\n Describe your
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSwap \'m\' and \'f\' values using a single update statement\n# Approach\n<!-- Describe your approach to solving the problem. -->\nReturn the updated DataFrame\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$O(n)$ Beats 64.03% of users with Pandas\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$O(n)$ Beats 7.31% of users with Pandas\n# Code\n```\nimport pandas as pd\n\ndef swap_salary(salary: pd.DataFrame) -> pd.DataFrame:\n    # Swap \'m\' and \'f\' values using a single update statement\n    salary[\'sex\'] = salary[\'sex\'].map({\'m\': \'f\', \'f\': \'m\'})\n\n    # Return the updated DataFrame\n    return salary\n```
['Pandas']