Using a lambda function
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nimport pandas as pd\n\ndef swap_salary(salary: pd.DataFrame) -> pd.DataFrame:\n    salary[\'sex\'] = salary[\'sex\'].apply(lambda x: \'f\' if x==\'m\' else \'m\')\n    return salary\n\n    \n```
['Pandas']