I have my dataset
called movies
in the following way:
item_id genre
1 Animation|Children's|Comedy
2 Animation|Children's|Musical|Romance
3 Drama
I would like to achieve something like this:
item_id genre
1 Animation
1 Children's
1 Comedy
2 Animation
2 Children's
2 Musical
2 Romance
3 Drama
Meaning I want to split it through the different genres on a new line. The code until now, however it's not working and I don't understand what's wrong:
movies.genre = movies.genre.str.split('|')
movies = explode(movies, ['genre'])
movies.head()
The error:
NameError: name 'explode' is not defined
Thank you in advance!