Problem 2: Standardize Inconsistent Categories
Easypython
Problem Description
Write a Python program that standardizes a "gender" column containing "M", "male", "F", "female" into consistent "Male"/"Female" labels.
Input
A DataFrame with a "gender" column containing inconsistent labels.
Output
The standardized "gender" column.
Constraints
- Only these four label variations will appear.
Example Input
text["M", "female", "Male", "F"]
Example Output
text["Male", "Female", "Male", "Female"]
Concepts Covered
.replace(), dictionaries.