Q:

function to join strings and some values from columns

I have a pandas dataframe with columns and rows. Now I want to create another column which will be a concatenation of two strings and a column from the dataframe.
so the way it would work is i have string one (see the below dictionary)+ colx (from dataframe) + string two
stringList = {
     'one': """ AC:A000 AMI:NO CM:B C:YES CL:CPN:'#US3L+""",
     'two': """ FRQ:4  NOT:1 PX:C PXND:1E-6:DOWN RDTE:MAT RP:1 SET:0WW XD:NO """
}

i tried to create a function but I think this is not working as I want. I want this to be a function so i can call it in another function.
def fun(final):

    for i in dm:
        c = stringList['one'] + str(dm[i]) + stringList['two']
        final.append(c)

Please help with this as I am stuck with this problem for now.
Required Output:
str1                                      |QM     |str2          |output
 AC:A000 AMI:NO CM:B C:YES CL:CPN:'#US3L+ |0.0125 | RQ:4  NOT:1 PX:C PXND:1E-6:DOWN RDTE:MAT RP:1 SET:0WW XD:NO|    AC:A000 AMI:NO CM:B C:YES CL:CPN:'#US3L+0.0125RQ:4  NOT:1 PX:C PXND:1E-6:DOWN RDTE:MAT RP:1 SET:0WW XD:NO

AC:A000 AMI:NO CM:B C:YES CL:CPN:'#US3L+    0.016   RQ:4  NOT:1 PX:C PXND:1E-
Hope this helps explain. I know it is not a very good representation but I have this problem which is critical to solve
THanks

A:

After looking at your output, I realized that you want to combine three columns str1, QM, and str2. I am assuming here that str1 and str2 have dtype str and QM has dtype float. You can use the following code to get the output column as below
df["output"] = df["str1"] + df["QM"].astype(str) +  df["str2"]

