I am trying to create a lambda function in order to remove duplicate words from each row of a column. I tried to define a variable as my column and to create a function that eliminates duplicate words from a sentence but I don't know how to apply that function to the entire column using lambda.
def unique_list(l):
lst = []
[lst.append(x) for x in l if x not in lst]
return lst
a = 'shoes dress apple shoes mango apple'
a = ' '.join(unique_list(a.split())) # 'shoes dress apple mango'
My column is 'dup_words', can you please help me understand how can I apply the above function to all the rows in my column using lambda?