I have a Pandas Dataframe in which the columns contain list of values. Like the below.
A B
0 ['x','x','y','y','z'] ['m','m','n','n','p']
I would like to create separate columns for each unique item in the lists and mention the count of each item under those new columns.
A B x y z m n p
0 ['x','x','y','y','z'] ['m','m','n','n','p'] 2 2 1 2 2 1
Can someone help in writing the code for this?