import pandas as pd
import numpy as np
df=pd.DataFrame({"Names":["This is Santhosh","This is Sneha Alphonse Shaji","This is Vikram Karthi"]})
df
Name_set=['Santhosh','Sneha Alphonse Shaji','Vikram Karthi']
def sub(x):
ans = [y for y in Name_set if y in x]
return ' '.join(ans)
df['Extracted Names']= df.Names.apply(sub)
df
Names Extracted Names
0 This is Santhosh Santhosh
1 This is Sneha Alphonse Shaji Sneha Alphonse Shaji
2 This is Vikram Karthi Vikram Karthi