I am trying to parse a movie database with Python 3. How can I parse genres of a movie with different variables? For example:
1,Toy Story (1995),Adventure|Animation|Children|Comedy|Fantasy
2,Jumanji (1995),Adventure|Children|Fantasy
First value is movie_id, second is movie_name, and the third values are genres but I want to parse them as separate variables that belong to corresponding movie. In other words, I want second separator to my database as "|". How can I achieve this? Here is my code:
import numpy as np
import pandas as pd
header = ["movie_id", "title", "genres"]
movie_db = pd.read_csv("movielens/movies.csv", sep=",", names=header)