Replace part column value with value from another column of same dataframe I have a dataframe with two columns:
Name          DATE
Name1         20200126
Name2         20200127
Name#DATE#    20200210

I need to replace all the #DATE# with the data from the DATE column, and get something like this:
Name          
Name1         
Name2         
Name20200210

How can I achieve this? I've tried things like this, without any good result..:
df_merged_tables[&quot;Name&quot;].str.replace(&quot;#DATE#&quot;,merged_tables[&quot;DATE&quot;])

Thanks!
Your solution is close
Maybe just needed to add an apply.
Try:
df = pd.DataFrame({&quot;Name&quot;:[&quot;Name1&quot;, &quot;Name2&quot;, &quot;Name#DATE#&quot;], &quot;Date&quot;:[20200126, 20200127, 20200210]})

df[&quot;NewColumn&quot;] = df.apply(lambda row: row[&quot;Name&quot;].replace(&quot;#DATE#&quot;, str(row[&quot;Date&quot;])), axis = 1)

Outputs: