Often, you'll find that you need to remove one or more characters from within a string. Real-world examples of this include internal abbreviations such as FKA (Formerly Known As) or suffixes such as Jr. or Sr.
Continue using the customer's DataFrame you created earlier, or import the file into a new DataFrame.
def remove_internal_abbreviations(s, thing_to_replace, replacement_string): """ Helper function to remove one or movre characters from a string s: the full string thing_to_replace: what you want to replace in the given string replacement_string: the string to use as a replacement """ try: s = s.replace(thing_to_replace, replacement_string) except: pass return s customers['last_name'] = customers.apply(lambda x: remove_internal_abbreviations(x['last_name'], "FKA", "-"), axis=1)