Reputation: 3
Using Jupyter, I have three gender categories in a column (m, male and female), and I want to replace "m" by "male", when I try this code, also "female" become "femaleale".
df['Gender'].replace(regex=[r'\bm\b'],value='male')
output
male
femaleale
male
...
Upvotes: 0
Views: 145
Reputation: 983
df['Gender'].replace(['m'], ['male'], inplace=True)
You can try this!!
Upvotes: 2