I am trying to apply the following two functions but with applicability only to specific rows of my df.
For example, the function should run only when the value from column1 is populated with the string 'this is a sentence'. In this case, if the value on column1 is found, the functions should run for other two columns but only on the correspondent rows where the value was found in column1.
Like per this example

```
column1                   column2                 column3         output_required
this is a sentence        phrase1                 SENT            SENT phrase1
this is a brand           phrase2                 10              10
no value available        phrase3                 apple           apple
this is a sentence        phrase4                 Fruits          Fruits phrase4

```

My functions are:

```
    #concatenate with value from column 3
col_target = 'column3'
col_restrict = 'column2'

target = df[col_target].tolist()  # this generates a list of lists
restrict = df[col_restrict].tolist()  # this also generates a list of lists

def parse_str_into_list(s):
    if str(s).startswith('[') and str(s).endswith(']'):
        return ' '.join(str(s).strip('[]').strip("'").split("', '"))
    return str(s)
def filter_restrict_words(row):
    targets = parse_str_into_list(row[0]).split(' ', -1)
    restricts = parse_str_into_list(row[1]).split(' ', -1)
    words_to_keep = []
    for word in targets:
        # condition to keep eligible words
        if word not in words_to_keep:
            # if word not in restricts and word not in words_to_keep:
            words_to_keep.append(word)
            print('words to keep')
            print(words_to_keep)

    return ' '.join(words_to_keep)

df['Title'] = df[[col_target, col_restrict]].apply(lambda x: filter_restrict_words(x), axis=1)
df['output_required'] = df['Title'].map(str) + ' ' + df['column3'].map(str)

#and remove duplicates keeping the first occurrence
def uniqueList(row):
    words = row.split(" ")
    unique = words[0]
    for w in words:
        if w.lower() not in unique.lower():
            unique = unique + " " + w
    return unique
df["Correction_Value"] = df["Correction_Value"].apply(uniqueList)

```

At this point, these funtions are running on all the rows of my df.