This problem needs to be solved in python. Write a function read_movies_data(f) that takes in a movies file and returns a pandas DataFrame, where the index is the movie id and the columns are "title", "year", and "genre" (in that order). movies_df = read_movies_data("moviesSample.txt") assert movies_df.shape == (9, 3) assert movies_df.iloc[2, 2] == "Comedy" assert movies_df.loc[6, "title"] == "Heat" assert all(movies_df.columns == ["title", "year", "genre"]) assert list(movies_df.index) == [1, 2, 3, 4, 5, 6, 8, 9, 10] NOTE: Make sure all of the asserts work The moviesSample.txt looks like this: 1|Toy Story|1995|Adventure 2|Jumanji|1995|Adventure 8|Tom and Huck|1995|Adventure 3|Grumpier Old Men|1995|Comedy 4|Waiting to Exhale|1995|Comedy 5|Father of the Bride Part II|1995|Comedy 6|Heat|1995|Action 9|Sudden Death|1995|Action 10|GoldenEye|1995|Action NOTE: Try to sent screenshots of the code working.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 12VE
icon
Related questions
Question

This problem needs to be solved in python.

Write a function read_movies_data(f) that takes in a movies file and returns a pandas DataFrame, where the index is the movie id and the columns are "title", "year", and "genre" (in that order).

movies_df = read_movies_data("moviesSample.txt")
 
assert movies_df.shape == (9, 3)
assert movies_df.iloc[2, 2] == "Comedy"
assert movies_df.loc[6, "title"] == "Heat"
assert all(movies_df.columns == ["title", "year", "genre"])
assert list(movies_df.index) == [1, 2, 3, 4, 5, 6, 8, 9, 10]
 
NOTE: Make sure all of the asserts work
 
The moviesSample.txt looks like this:
1|Toy Story|1995|Adventure
2|Jumanji|1995|Adventure
8|Tom and Huck|1995|Adventure
3|Grumpier Old Men|1995|Comedy
4|Waiting to Exhale|1995|Comedy
5|Father of the Bride Part II|1995|Comedy
6|Heat|1995|Action
9|Sudden Death|1995|Action
10|GoldenEye|1995|Action
 
NOTE: Try to sent screenshots of the code working.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning