I have to convert this to a binary table wherein the index values of the binary table are the order IDs and the column values of the binary table are bread,cheese,eggs,flour,and jam. The values of the binary table are either 1 or 0: 1 if that specific order contains the product and 0 if it doesn't.
OrderNum
1000 [eggs]
1001 [bread]
1002 [eggs, bread, flour]
1003 [eggs, jam, bread]
1004 [eggs]
...
1495 [eggs, bread, flour]
1496 [eggs, cheese, bread]
1497 [jam]
1498 [bread]
1499 [eggs, bread]
Length: 500, dtype: object
It should look like this:
bread cheese eggs flour jam
1000 0 0 1 0 0
1001 1 0 0 0 0
1002 1 0 1 1 0
1003 1 0 1 0 1
1004 0 0 1 0 0
...
1495 1 0 1 1 0
1496 1 1 1 0 0
1497 0 0 0 0 1
1498 1 0 0 0 0
1499 1 0 1 0 0
Does anyone know how to do this?