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.
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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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]
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
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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education