import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def suitability (x):
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
print("Hello and Welcome to your own Disney Movies Guide")
age=int(input("What is your age?"))
disney_data = pd.read_csv('/content/disney_plus_titles.csv')
disney_data.head()
def suitability (x):
if x['rating'] == "TV-G" :
return 'For all audiences'
elif x['rating'] == "TV-PG" :
return 'unsuitable for children under 17'
elif x['rating'] == "PG" :
return 'Some Material May Not Be Suitable for Children.'
elif x['rating'] == "PG13":
return 'Some Material May Be Inappropriate for Children Under 13'
elif x['rating']== "NaN":
return 'Not a Number'
disney_data['suitability'] = disney_data.apply(suitability,axis=1)
disney_data.head()
print(" Disney Movies ")
print("1. Alphabetical Sorting.")
print("2. Random Generator")
print("3. Suitability")
print("4. Duration")
choice=choice=int(input("What's your choice : "))
from IPython.display import display
if choice == 1:
print("Alphabetically sorted list of Disney movies!")
disney_data=pd.read_csv('/content/disney_plus_titles.csv')
disney_data.sort_values('title', ascending=True)
display(disney_data)
elif choice == 2:
print("Here is your random movie to watch!")
disney_data=pd.read_csv('/content/disney_plus_titles.csv')
display(disney_data.iloc[np.random.choice(np.arange(len(disney_data)), 1, False)])
elif choice == 3:
print("This shows you the movies that are suitable for your age")
if age <= 13:
display(disney_data.loc[disney_data['rating'] == "TV-G"])
if age >= 17:
display(disney_data.loc[disney_data['rating'] == "TV-PG"])
if age == 18:
display(disney_data.loc[disney_data['rating'] == "PG"])
if age >= 21:
display(disney_data.loc[disney_data['rating'] == "PG-13"])
elif choice == 4:
print("These are the shortest movies you can enjoy")
display(disney_data.loc[disney_data['duration'] == "10 min"])
# demonstrate the correctness of your code by showing it works as intended on a number of well-identified test cases