I have simple data like below its MovieLense 1M data files
item_id title genres
1 1 Toy Story (1995) Animation|Children's|Comedy
2 2 Jumanji (1995) Adventure|Children's|Fantasy
3 3 Grumpier Old Men (1995) Comedy|Romance
4 4 Waiting to Exhale (1995) Comedy|Drama
5 5 Father of the Bride Part II (1995) Comedy
6 6 Heat (1995) Action|Crime|Thriller
my genres
column data contain 19 values. How should I change my data to shown like above sample?
Genre Table
genreTbl['title']
title
1 unknown
2 Action
3 Adventure
4 Animation
5 Children's
6 Comedy
7 Crime
8 Documentary
9 Drama
10 Fantasy
11 Film-Noir
12 Horror
13 Musical
14 Mystery
15 Romance
16 Sci-Fi
17 Thriller
18 War
19 Western
I want to change my data to this structure:
item_id movie_title release_date
1 1 Toy Story (1995) <NA>
2 2 GoldenEye (1995) <NA>
3 3 Four Rooms (1995) <NA>
4 4 Get Shorty (1995) <NA>
5 5 Copycat (1995) <NA>
6 6 Shanghai Triad (Yao a yao yao dao waipo qiao) (1995) <NA>
unknown Action Adventure Animation Children's Comedy Crime Documentary Drama
1 0 0 0 1 1 1 0 0 0
2 0 1 1 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
4 0 1 0 0 0 1 0 0 1
5 0 0 0 0 0 0 1 0 1
6 0 0 0 0 0 0 0 0 1
Fantasy Film-Noir Horror Musical Mystery Romance Sci-Fi Thriller War Western
1 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 1 0 0
3 0 0 0 0 0 0 0 1 0 0
4 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 1 0 0
6 0 0 0 0 0 0 0 0 0 0
I need all my genres be in column just like above and if my item genre value contain selected genre value should be 1 else 0.