0

Hi I have a DataFrame with column Text which contains strings. What I want to do is to find my pattern:

pattern = "Car:" + "|".join(["Audi", "Toyota"])

and simply change Car to MyCar for those findings (Toyota and Audi). How can I do that for the entire df?

Input: pd.DataFrame("Text": ["ThisIsCar:Audi", "ThisIsCar:BMW"])

Output: pd.DataFrame("Text": ["ThisIsMyCar:Audi", "ThisIsCar:BMW"])

Jason
  • 313
  • 2
  • 8

0 Answers0