Question: PLEASE USE JUPYTER LAB!!!!!!!! Question 1 Write a function called ReadJSON that reads any JSON into an object. ReadJSON(path) - Arguments: path - string -
PLEASE USE JUPYTER LAB!!!!!!!!
Question 1
Write a function called ReadJSON that reads any JSON into an object.
ReadJSON(path)
- Arguments: path - string
- Return: object
Question 2
Use the movies dataset for questions 2-5
Write a function called MoviesByCategories that returns an object of all the movies that belong to a list of categories. A movie only has to have one of the categories to be included.
Example of categories is ['comedy','drama']
GetMoviesByCategories(movies, categories)
- Arguments: movies - object, categories - 1D List
- Return: movies - object
Question 3
Write a function called MoviesByActor that returns a 1D list of movie names for all of the movies a given actor has appeared in.
MoviesByActor (movies, actor_name)
- Arguments: movies - object, actor_name - string
- Return: List - [movie names]
Question 4
Write a function called BusiestDirector that returns an object (list of dictionaries) of director names and the number of movies they gave directed. The object should be sorted by movie_count from highest to lowest.
BusiestDirector (movies)
- Arguments: movies - object
- Return: directors - object - ('director': director name, 'movie_count': number of movies directed)
Question 5
Write a function called MoviesByBirthPlace that returns a 1D list of movie names for all movies that include actors whose birthplace matches a given place, i.e. 'Pennsylvania', 'USA', 'Scotland'
MoviesByBirthPlace (movies, place)
-Arguments: movies - object, place - string
- Return: 1D List - [movie names]
Question 6
Write a function called CountCategories that returns a dictionary of all movie categories and the number of times each category is assigned.
CountCategories(movies)
- Arguments: movies - object
- Return: dictionary - {category:count} sorted by count from highest to lowest
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
