I am trying to split a column into multiple columns based off comma/space seperation.
my dataframe currently looks like
Item Colors
0 ID-1 Red, Blue, Green
1 ID-2 Red, Blue
2 ID-3 Blue, Green
3 ID-4 Blue
4 ID-5 Red
I would like to transform the 'Colors' column into Red, Blue and Green like this:
Item Red Blue Green
0 ID-1 1 1 1
1 ID-2 1 1 0
2 ID-3 0 1 1
3 ID-4 0 1 0
4 ID-5 1 0 1
I really have no idea how to do this. Any help would be greatly appreciated.
You can using
get_dummies