I have a data frame called df that looks something like this:
pd.DataFrame({
'column1' : ['client#1 is #name#', 'client#2 is #name#'],
'column2': ['josh', 'max']}
)
column1 column2
0 client#1 is #name# josh
1 client#2 is #name# max
I am trying to replace the phrase "#name" in column1 with the value of column2. I want the end result to look like this:
I have tried a few approaches like the following:
df['column1'] = df['column1'].replace(["#name#"], df['column2'])
But I am not sure of how to grab the specific phrase '#name#' in column1 and replace it with the value of column2. Any suggestions on how to approach this would be greatly appreciated!