replace() method not working on Pandas DataFrame

Given that this is the top Google result when searching for “Pandas replace is not working” I’d like to also mention that:

replace does full replacement searches, unless you turn on the regex
switch. Use regex=True, and it should perform partial replacements as
well.

This took me 30 minutes to find out, so hopefully I’ve saved the next person 30 minutes.

Leave a Comment