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

last update

parent fc16e100
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
show_id,type,title,director,cast,country,date_added,release_year,rating,duration,listed_in,description
s1237,Movie,Sentinelle,Julien Leclercq,"Olga Kurylenko, Marilyn Lima, Michel Nabokoff, Martin Swabey, Carole Weyers, Andrey Gorlenko, Antonia Malinova, Gabriel Almaer, Blaise Afonso, Guillaume Duhesme, Michel Biel",France,"March 5, 2021",2021,TV-MA,81 min,"Action & Adventure, Dramas, International Movies","Transferred home after a traumatizing combat mission, a highly trained French soldier uses her lethal skills to hunt down the man who hurt her sister."
s2669,Movie,Earth and Blood,Julien Leclercq,"Sami Bouajila, Eriq Ebouaney, Samy Seghir, Sofia Lesaffre","France, Belgium","April 17, 2020",2020,TV-MA,81 min,"Dramas, International Movies, Thrillers",A sawmill owner and his teenage daughter become tangled in a deadly feud when a drug dealer stashes stolen cocaine on their remote property.
Aucun aperçu pour ce type de fichier
# afficher le premier document
# ALL the imports
import pandas as pd
import tabulate
import os
......@@ -27,7 +26,7 @@ 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): # enregistrement
def movies(data_1): # register
films = data_1[data_1['type'] == 'Movie'] # Filter the data to include only movies
movie_titles = films['title'].tolist() # Extract movie titles
......@@ -129,8 +128,6 @@ def by_country(data_1):
# Be careful, you need to ask each time if they want to save the list to a .csv
def genre(data_1):
filtered_data = filter_media_type(data_1)
......@@ -174,8 +171,6 @@ def genre(data_1):
return
from fuzzywuzzy import process
def duration(data_1):
filtered_data = filter_media_type(data_1)
......@@ -254,7 +249,9 @@ def director(data_1):
if director_name not in director_list and director_name != '':
director_list.append(director_name)
# Sort the director_list in alphabetical order
print("List of all possible directors: ")
director_list = sorted(director_list)
print(director_list)
while True:
......@@ -298,6 +295,7 @@ def actor(data_1):
if actor_name not in actor_list and actor_name != '':
actor_list.append(actor_name)
actor_list = sorted(actor_list)
print("List of all possible actors: ")
print(actor_list)
......@@ -340,7 +338,10 @@ def specific_genre_director(data_1):
unique_directors = filtered_data['director'].unique()
# Convert elements to strings to handle potential float values
unique_directors = [str(director) for director in unique_directors]
# Sort the unique_directors in alphabetical order
unique_directors = sorted(unique_directors)
print("List of all available directors:")
print(', '.join(unique_directors))
......@@ -366,6 +367,9 @@ def specific_genre_director(data_1):
# Get a list of all available types without duplicates
unique_types = filtered_data['listed_in'].str.split(', ').explode().unique()
# Sort the unique_types in alphabetical order
unique_types = sorted(unique_types)
print("\nList of all available types:")
print(', '.join(unique_types))
......@@ -412,7 +416,10 @@ def specific_genre_actor(data_1):
# Get a list of unique actors
unique_actors = filtered_data['cast'].str.split(', ').explode().unique()
unique_actors = [str(actor) for actor in unique_actors]
# Sort the unique_actors in alphabetical order
unique_actors = sorted(unique_actors)
print("List of all available actors:")
print(', '.join(unique_actors))
......@@ -436,6 +443,9 @@ def specific_genre_actor(data_1):
# Get a list of all available types without duplicates
unique_types = filtered_data['listed_in'].str.split(', ').explode().unique()
# Sort the unique_types in alphabetical order
unique_types = sorted(unique_types)
print("\nList of all available types:")
print(', '.join(unique_types))
......@@ -674,39 +684,50 @@ def basic_statistics(data_1):
# attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv
def save_to_csv(data, default_filename='output.csv'):
# Ask if the user wants to save to a CSV file
save_choice = input("Do you want to save the data to a CSV file? (YES/NO): ").upper()
if save_choice == 'YES':
# Prompt for a file name
file_name = input("Enter the file name (DO NOT include .csv extension, or press Enter for the default): ")
file_name = file_name + ".csv"
if not file_name:
file_name = default_filename
# Check if the file already exists
if os.path.exists(file_name):
# Ask if the user wants to overwrite or create a new file
overwrite_choice = input(f"The file '{file_name}' already exists. Do you want to overwrite it? (YES/NO): ").upper()
if overwrite_choice == 'YES':
# Overwrite the existing file
while True:
# Ask if the user wants to save to a CSV file
save_choice = input("Do you want to save the data to a CSV file? (YES/NO): ").upper()
if save_choice == 'YES':
# Prompt for a file name
file_name = input("Enter the file name (DO NOT include .csv extension, or press Enter for the default): ")
file_name = file_name + ".csv"
if not file_name:
file_name = default_filename
# Check if the file already exists
if os.path.exists(file_name):
while True:
# Ask if the user wants to overwrite or create a new file
overwrite_choice = input(f"The file '{file_name}' already exists. Do you want to overwrite it? (YES/NO): ").upper()
if overwrite_choice == 'YES':
# Overwrite the existing file
data.to_csv(file_name, index=False)
print(f"Data saved to {file_name}")
break
elif overwrite_choice == 'NO':
# Prompt for a new file name
new_filename = input("Enter a new file name (DO NOT include .csv extension): ")
new_filename = new_filename + ".csv"
data.to_csv(new_filename, index=False)
print(f"Data saved to {new_filename}")
break
else:
print("Invalid choice. Please enter either 'YES' or 'NO'.")
else:
# Save to a new file
data.to_csv(file_name, index=False)
print(f"Data saved to {file_name}")
break
else:
# Prompt for a new file name
new_filename = input("Enter a new file name (DO NOT include .csv extension): ")
new_filename = new_filename + ".csv"
data.to_csv(new_filename, index=False)
print(f"Data saved to {new_filename}")
else:
# Save to a new file
data.to_csv(file_name, index=False)
print(f"Data saved to {file_name}")
elif save_choice == 'NO':
print("Data not saved.")
break
else:
print("Data not saved.")
else:
print("Invalid choice. Please enter either 'YES' or 'NO.'")
......@@ -802,11 +823,6 @@ def recommend_movies(user_id, catalog, user_ratings, category_matrix, threshold=
return sorted_suggestions[:5]
# Ajout d'impression pour déboguer
print("User categories:", categories)
def recommandation_algorithm() :
# Replace file_path_1 and file_path_2 with the actual file paths
......
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