Skip to content
Extraits de code Groupes Projets
Valider 76a0ab2a rédigé par Adrien Payen's avatar Adrien Payen
Parcourir les fichiers

last update

parent 1aa260e5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
......@@ -26,11 +26,13 @@ def catalog(data_1):
# Be careful, you need to ask each time if they want to save the list to a .csv
def movies(data_1):
def movies(data_1): # enregistrement
films = data_1[data_1['type'] == 'Movie'] # Filter the data to include only movies
movie_titles = films['title'].tolist() # Extract movie titles
# afficher que les 100 premiers
print(movie_titles) # Display movie titles
save_to_csv(movie_titles)
......@@ -157,6 +159,7 @@ def director(data_1):
director_list.append(director_name)
print("List of all possible directors: ")
print(director_list)
director_input = input("Enter the name of the director to display movies and/or series: ")
director_data = filtered_data[filtered_data['director'].str.lower().str.contains(director_input.lower(), case=False, na=False)]
......@@ -165,8 +168,8 @@ def director(data_1):
director_data_sorted = director_data.sort_values(by='release_year', ascending=True) # see if we do in ascending or descending
print(director_data)
save_to_csv(director_data)
print(director_data_sorted)
save_to_csv(director_data_sorted)
else:
print(f"No person found with the name {director_input}.")
......@@ -181,6 +184,7 @@ def actor(data_1):
actor_list.append(actor_name)
print("List of all possible actors: ")
print(actor_list)
actor_input = input("Enter the name of the actor to display movies and/or series: ")
actor_data = filtered_data[filtered_data['cast'].str.lower().str.contains(actor_input.lower(), case=False, na=False)]
......@@ -280,7 +284,7 @@ def most_rated(data_1, data_2) :
def most_rated_year(data_1, data_2):
# Display all available unique release years
available_years = data_1['release_year'].unique()
print("Available years: ", available_years)
print("Available years: ", available_years) # tri des dates
# Ask the user to enter a release year
year = input("Enter a release year: ")
......@@ -324,7 +328,7 @@ def most_rated_recent(data_1, data_2):
# Example usage
def parental_code(data_1):
def parental_code(data_1): # s5542 bug concernant les virgules
code_list = []
for codes in data_1['rating'].dropna().str.split(', '):
......@@ -446,6 +450,7 @@ def save_to_csv(data, default_filename='output.csv'):
open_choice = input("Do you want to open the saved file? (YES/NO): ").upper()
if open_choice == 'YES':
os.system(file_name)
else:
# Prompt for a new file name
new_filename = input("Enter a new file name (DO NOT include .csv extension): ")
......@@ -519,6 +524,7 @@ def create_category_matrix(catalog, categories):
if categories[j] in movie_categories[1]:
category_matrix[i + 1][j + 1] += 1 # Commencez à remplir à partir de la deuxième ligne et de la deuxième colonne
# Ajoutez les noms de catégories à la première colonne et les données de la matrice
return category_matrix
......@@ -593,15 +599,15 @@ def recommandation_algorithm() :
# Création du menu
def action() :
print("Here are the different options available:")
print("1. View the entire catalog")
print("2. View all movies in the catalog")
print("3. View all series")
print("4. View all series, movies or both by year")
print("5. View all series, movies or both by country")
print("6. View all series, movies or both by type")
print("7. View all series, movies or both by type sorted by duration")
print("8. View series, movies or both directed by a specific director and sorted by year")
print("9. View series, movies or both featuring a specific actor and sorted by year")
print("1. View the entire catalog")
print("2. View all movies in the catalog")
print("3. View all series")
print("4. View all series, movies or both by year")
print("5. View all series, movies or both by country")
print("6. View all series, movies or both by type")
print("7. View all series, movies or both by type sorted by duration")
print("8. View series, movies or both directed by a specific director and sorted by year")
print("9. View series, movies or both featuring a specific actor and sorted by year")
print("10. View how many series, movies or both and series directed by a director in a specific genre")
print("11. View how many series, movies or both an actor has played in")
print("12. Display the highest-rated series, movies or both")
......
Fichier supprimé
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter