I've this issue and i've been doing quite a few researches and doing some testing without success.
I've a Dataframe which one of the variables content looks like this:
var1 = ['QALIF',
['PRD', 'PRD', 'PRD', 'PRD', 'PRD'],
['DV', 'DV', 'DV', 'DV', 'DV', 'DV', 'DV']]
I don't know how represent this in a dataframe, when I convert into pd.DataFrame(var1) the Data Frame splits into several columns which is not the case. The values are type text for Single values or liste of values with different lengths.
I need to get unique values for each list inside my Dataframe, in other words, iterate over my variable "var1" and convert the "List" into Single value
I've been trying to get some inspiration thought this link below, some test did work fine but when I try to apply to entire dataset it doesn't return good results.
Get unique values from a list in python
I've build a (several) functions :
for lst in df[var1]:
df[var1].apply(lambda x: list(dict.fromkeys(lst)))
But I get an error
List object is not callable
And I've tried so many other options but none of them seem to work.
Any help is welcome