I'd like to transform this :
In [4]: df
Out[4]:
label
0 (a, e)
1 (a, d)
2 (b,)
3 (d, e)
to This :
a b c d e
0 1 0 0 0 1
1 1 0 0 1 0
2 0 1 0 0 0
3 0 0 0 1 1
As you can see there are predefined columns, 'a', 'b', 'c', 'd', 'e' and c is empty but still exists.
I tried multiple things like this : df.str.join('|').str.get_dummies() first without all the columns just to get the dummies with multiple values in the input but I want to add the predefined columns thing to it.
Thank you for your help !