Suppose we have a string and a dataframe like this:
import pandas as pd
myStr="Insert {var1} here & here {var1} and insert {var2} here & here {var2}."
df = pd.DataFrame({'Var1': (1, 2), 'Var2': ('B', 'C')}
>>> df
Var1 Var2
0 1 B
1 2 C
Now I add the myStr as a new column and I wanna insert the the var 1 and var2 their locations within the myStr. I am looking to get something like below. I was thinking to use f-strings but not sure what is the best way to do it in pandas.
Var1 Var2 new_col
1 B Insert 1 here & here 1 and insert B here & here B.
2 C Insert 2 here & here 2 and insert C here & here C.