Dataframe:
MovieID | movieCater |
---|---|
1 | Action, Comedy, Adventure |
2 | Action, Crime |
3 | Crime |
What I want:
MovieID | movieCater | Action | Comedy | Adventure | Crime |
---|---|---|---|---|---|
1 | Action, Comedy, Adventure | 1 | 1 | 1 | 0 |
2 | Action, Crime | 1 | 0 | 0 | 1 |
3 | Crime | 0 | 0 | 0 | 1 |
my data frame does not include action, comedy, and others columns. is there any method that makes that happen? for example the first of movieCater include action, comedy, and adventure. then go to the corresponding column name and set it to 1.