I have a dataframe as follows:
import pandas as pd
df = pd.DataFrame({'text':['Lary Page is visiting today',' His boss, Maria Jackson is here.']})
I have extracted the names in the list below. and used faker library to create fake names equal to the len of the person_name list, and created a dictionary out of the lists.
from faker import Faker
fake = Faker()
person_name = ['Lary Page', 'Maria Jackson']
fake_name= [fake.name() for n in range(len(person_name))]
name_dict = dict(zip(person_name, fake_name ))
now I would like to replace them in the dataframe using the dictionary, but it returns an error.
df.text.str.replace(name_dict)
my desired output:(e.g)
print(df)
Angela Mindeston is visiting today
His boss, Emanuel Smith is here.