Ok so I am a relative noob to Python. I have a need for a transformation of the following dataframe
bd, date
[[None]], 2017-11-01 09:00:00
[[Sulphur], [Green Tea]], 2017-11-02 09:00:00
[[Green Tea], [Jasmine]], 2017-11-03 09:00:00
.....
to be transformed to
date, None, Sulphur, Green Tea, Jasmine...
2017-11-01 09:00:00, 1, 0, 0, 0...
2017-11-02 09:00:00, 0, 1, 1, 0...
2017-11-03 09:00:00, 0, 0, 1, 1...
The items in the embedded list in column BD are dynamic and cannot be predefined columns in the new dataFrame.
I tried the following through another helpful post Create new columns in pandas from python nested lists but could not adapt it successfully
suppDF1 = suppDF.bd.apply(lambda x: pd.Series(1, x)).fillna(0).astype(int)
Using the code above I only see 5 columns with incorrect 1s so I am clearly out of my depth.
Update
I tried Max's suggestion but I guess I may have something erroneous in my attempt at using pivot:
suppDF1 = suppDF.pivot(index="date", columns="bd")["bd"]
I get the following error
unhashable type: 'list'