Is there a way to get a case insensitive regex replace to work on a Pandas dataframe? I would prefer to keep the work vectorised instead of having to resort to creating a loop at the string level to which re.sub is apparently limited.)
(When I try to use re.sub with the dataframe the compiler complains that it needs strings.)
fables['animal_names'] = re.sub(r"(^|\s+|,)hippo(,|\s+|$)"," Hippopotamus ", fables['animal_names'])
TypeError: expected string or bytes-like object