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

update work

parent 37edb2e2
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
Fichier ajouté
# afficher le premier document # afficher le premier document
import pandas as pd import pandas as pd
import tabulate
import os
file_path_1 = "/content/drive/MyDrive/Coding_project_2023/netflix_titles-2.csv" # allow us to display maximum things
#pd.set_option('display.max_rows', None)
"""file_path_1 = "/content/drive/MyDrive/Coding_project_2023/netflix_titles-2.csv
data_1 = pd.read_csv(file_path_1)
data_1 = pd.read_csv(file_path_1)"""
#display(data_1) #display(data_1)
from google.colab import drive """from google.colab import drive
drive.mount('/content/drive') drive.mount('/content/drive')"""
# afficher le second document # afficher le second document
import pandas as pd
file_path_2 = "/content/drive/MyDrive/Coding_project_2023/ratings.csv"
data_2 = pd.read_csv(file_path_2) """file_path_2 = "/content/drive/MyDrive/Coding_project_2023/ratings.csv
data_2 = pd.read_csv(file_path_2)"""
#display(data_2) #display(data_2)
import pandas as pd
file_path_1 = "/content/drive/MyDrive/Coding_project_2023/netflix_titles-2.csv" """file_path_1 = "/content/drive/MyDrive/Coding_project_2023/netflix_titles-2.csv"""
file_path_1 = "/Users/adrien/vscodeworkspace/coding-project/projet_en_groupe/data_cp_2023/netflix_titles-2.csv"
data_1 = pd.read_csv(file_path_1) data_1 = pd.read_csv(file_path_1)
file_path_2 = "/content/drive/MyDrive/Coding_project_2023/ratings.csv" """file_path_2 = "/content/drive/MyDrive/Coding_project_2023/ratings.csv"""
file_path_2 ="/Users/adrien/vscodeworkspace/coding-project/projet_en_groupe/data_cp_2023/ratings.csv"
data_2 = pd.read_csv(file_path_2) data_2 = pd.read_csv(file_path_2)
# faire une fonction d'enregistrement
# Show the catalog
def catalog(data_1):
print(data_1.head(100))
save_to_csv(data_1)
# Be careful, you need to ask each time if they want to save the list to a .csv
# Montrer le catalogue
def catalogue(data_1) :
display(data_1)
return # attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv def movies(data_1):
films = data_1[data_1['type'] == 'Movie'] # Filter the data to include only movies
movie_titles = films['title'].tolist() # Extract movie titles
print(movie_titles) # Display movie titles
save_to_csv(movie_titles)
def film(data_1): return # Be careful, you need to ask each time if they want to save the list to a .csv
films = data_1[data_1['type'] == 'Movie'] # Filtrer les données pour inclure uniquement les films
titre_des_films = films['title'].tolist() # Extraire les titres des films
display(titre_des_films) # Afficher les titres des films def series(data_1):
return # attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv series = data_1[data_1['type'] == 'TV Show'] # Filter the data to include only series
series_titles = series['title'].tolist() # Extract series titles
print(series_titles) # Display series titles
save_to_csv(series_titles)
def series(data_1) : return # Be careful, you need to ask each time if they want to save the list to a .csv
series = data_1[data_1['type'] == 'TV Show'] # Filtrer les données pour inclure uniquement les series
titre_des_series = series['title'].tolist() # Extraire les titres des series
display(titre_des_series) # Afficher les titres des series def by_year(data_1): # be careful and/or !!!!!
return # attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv filtered_data = filter_media_type(data_1)
if filtered_data is None:
return # Exit the function if filter_media_type returns None
def year(data_1) : # attention et ou !!!!! sort_type = input("Do you want to sort the years in ascending or descending order? (ascending/descending)")
type_de_tri = input("Voulez-vous trier les années par ordre croissant ou décroissant ? (croissant/decroissant)") if sort_type == "ascending":
if type_de_tri == "croissant" : sorted_data = filtered_data.sort_values(by='release_year', ascending=True)
donnee_triee = data_1.sort_values(by='release_year',ascending=True) elif sort_type == "descending":
elif type_de_tri == "decroissant" : sorted_data = filtered_data.sort_values(by='release_year', ascending=False)
donnee_triee = data_1.sort_values(by='release_year',ascending=False) else:
else : print("Invalid choice. The dataset could not be sorted!")
print("Choix invalide. L'ensemble n'a pu être trié! ") return # Exit the function if the sort type is invalid
display(donnee_triee)
return # attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv print(sorted_data)
save_to_csv(sorted_data)
return # Be careful, you need to ask each time if they want to save the list to a .csv
def pays(data_1) :
liste_pays = []
for countries in data_1['country'].dropna().str.split(', '):
for country in countries:
if country not in liste_pays and country != '': # il faut aussi retrier les éléments vides.
liste_pays.append(country)
print("Liste de tous les pays disponibles :") def by_country(data_1):
liste_pays.sort() filtered_data = filter_media_type(data_1)
display(liste_pays)
country_input = input("Entrez le nom du pays pour afficher les films et/ou séries : ").capitalize() country_list = []
country_data = data_1[data_1['country'].str.lower().str.contains(country_input.lower(), case=False, na=False)] for countries in filtered_data['country'].dropna().str.split(', '):
for country in countries:
if country not in country_list and country != '':
country_list.append(country)
print("List of all available countries:")
country_list.sort()
print(country_list)
country_input = input("Enter the name of the country to display movies and/or series: ").capitalize()
country_data = filtered_data[filtered_data['country'].str.lower().str.contains(country_input.lower(), case=False, na=False)]
if not country_data.empty: if not country_data.empty:
display(country_data) print(country_data)
save_to_csv(country_data)
else: else:
print(f"Aucun film ou série trouvé pour le pays {country_input}.") print(f"No movies or series found for the country {country_input}.")
return
# Be careful, you need to ask each time if they want to save the list to a .csv
return # attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv
def typ(data_1) : def genre(data_1):
liste_genres = [] filtered_data = filter_media_type(data_1)
for genres in data_1['listed_in'].dropna().str.split(', ') :
for genre in genres :
if genre not in liste_genres and genre != '' :
liste_genres.append(genre)
print("Liste de tous les genres possibles :") genre_list = []
liste_genres.sort() for genres in data_1['listed_in'].dropna().str.split(', '):
display(liste_genres) for genre in genres:
if genre not in genre_list and genre != '':
genre_list.append(genre)
type_input = input("Entrez le type (romantic, action, drama, etc.) pour afficher les films et/ou séries : ").capitalize() print("List of all possible genres:")
type_data = data_1[data_1['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False)] genre_list.sort()
print(genre_list)
type_input = input("Enter the type (romantic, action, drama, etc.) to display movies and/or series: ").capitalize()
type_data = filtered_data[filtered_data['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False)]
if not type_data.empty: if not type_data.empty:
display(type_data) print(type_data)
else: else:
print(f"Aucun film ou série trouvé pour le type {type_input}.") print(f"No movies or series found for the type {type_input}.")
def duree(data_1) : def duration(data_1):
liste_genres = [] filtered_data = filter_media_type(data_1)
for genres in data_1['listed_in'].dropna().str.split(', ') : genre_list = []
for genre in genres : for genres in data_1['listed_in'].dropna().str.split(', '):
if genre not in liste_genres and genre != '' : for genre in genres:
liste_genres.append(genre) if genre not in genre_list and genre != '':
genre_list.append(genre)
print("Liste de tous les genres possibles :") print("List of all possible genres:")
liste_genres.sort() genre_list.sort()
display(liste_genres) print(genre_list)
type_input = input("Entrez le type (romantic, action, drama, etc.) pour afficher les films et/ou séries : ").capitalize() type_input = input("Enter the type (romantic, action, drama, etc.) to display movies and/or series: ").capitalize()
type_data = data_1[data_1['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False)] type_data = filtered_data[filtered_data['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False)]
if not type_data.empty: if not type_data.empty:
type_data_sorted = type_data.sort_values(by='duration', ascending=True) # voir si on fait en croissant ou décroissant type_data_sorted = type_data.sort_values(by='duration', ascending=True) # see if we do in ascending or descending
display(type_data_sorted) print(type_data_sorted)
else: save_to_csv(type_data_sorted)
print(f"Aucun film ou série trouvé pour le type {type_input}.") else:
print(f"No movies or series found for the type {type_input}.")
def director(data_1):
filtered_data = filter_media_type(data_1)
def real(data_1) : director_list = []
liste_dirs = [] for dirs in data_1['director'].dropna().str.split(', '):
for dirs in data_1['director'].dropna().str.split(', ') : for director_name in dirs:
for dir in dirs : if director_name not in director_list and director_name != '':
if dir not in liste_dirs and dir != '' : director_list.append(director_name)
liste_dirs.append(dir)
print("Liste de tous les directeurs possibles : ") print("List of all possible directors: ")
director_input = input("Entrez le nom du réalisateur pour afficher les films et/ou séries : ") director_input = input("Enter the name of the director to display movies and/or series: ")
director_data = data_1[data_1['director'].str.lower().str.contains(director_input.lower(), case=False, na=False)] director_data = filtered_data[filtered_data['director'].str.lower().str.contains(director_input.lower(), case=False, na=False)]
if not director_data.empty : if not director_data.empty:
director_data_sorted = director_data.sort_values(by='release_year', ascending=True ) # voir si on fait en croissant ou décroissant director_data_sorted = director_data.sort_values(by='release_year', ascending=True) # see if we do in ascending or descending
display(director_data) print(director_data)
else : save_to_csv(director_data)
print(f"Aucune personne trouvée à ce nom {director_input}.") else:
print(f"No person found with the name {director_input}.")
def acteur(data_1) : def actor(data_1):
liste_actors = [] filtered_data = filter_media_type(data_1)
for actors in data_1['cast'].dropna().str.split(', ') :
for actor in actors :
if actor not in liste_actors and actor != '' :
liste_actors.append(actor)
print("Liste de tous les acteurs possibles : ") actor_list = []
for actors in data_1['cast'].dropna().str.split(', '):
for actor_name in actors:
if actor_name not in actor_list and actor_name != '':
actor_list.append(actor_name)
actor_input = input("Entrez le nom de l'acteur pour afficher les films et/ou séries : ") print("List of all possible actors: ")
actor_data = data_1[data_1['cast'].str.lower().str.contains(actor_input.lower(), case=False, na=False)]
if not actor_data.empty : actor_input = input("Enter the name of the actor to display movies and/or series: ")
actor_data_sorted = actor_data.sort_values(by ='release_year', ascending=True) actor_data = filtered_data[filtered_data['cast'].str.lower().str.contains(actor_input.lower(), case=False, na=False)]
display(actor_data_sorted) if not actor_data.empty:
else : actor_data_sorted = actor_data.sort_values(by='release_year', ascending=True)
print(f"Aucune acteur trouvé à ce nom {actor_input}.")
print(actor_data_sorted)
save_to_csv(actor_data_sorted)
else:
print(f"No actor found with the name {actor_input}.")
def genre(data_1) : # attention, je pense que l'algorithme n'est pas correct def specific_genre_director(data_1):
filtered_data = filter_media_type(data_1)
unique_directors = filtered_data['director'].unique()
print("List of all available directors:")
print(', '.join(unique_directors))
director_input = input("Entrez le nom du réalisateur pour afficher les films et/ou séries : ") director_input = input("Enter the name of the director to display movies and/or series: ")
type_input = input("Entrez le type (romantic, action, drama, etc.) : ").capitalize() unique_types = filtered_data['listed_in'].unique()
print("\nList of all available types:")
print(', '.join(unique_types))
director_type_data = data_1[(data_1['director'].str.lower().str.contains(director_input.lower(), case=False, na=False)) & type_input = input("Enter the type (romantic, action, drama, etc.): ").capitalize()
(data_1['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False))] # permet de lister les directeurs en fonction du type fait
director_type_data = filtered_data[
(filtered_data['director'].str.lower().str.contains(director_input.lower(), case=False, na=False)) &
(filtered_data['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False))
]
if not director_type_data.empty: if not director_type_data.empty:
# Display the count # Display the count
count = len(director_type_data) count = len(director_type_data)
print(f"Le réalisateur {director_input} a réalisé {count} film(s) ou série(s) du type {type_input}.") print(f"The director {director_input} has directed {count} movie(s) or series of type {type_input}.")
else: print(director_type_data)
print(f"Aucun film ou série trouvé pour le réalisateur {director_input} et le type {type_input}.") save_to_csv(director_type_data)
else:
print(f"No movies or series found for the director {director_input} and type {type_input}.")
def specific_genre_actor(data_1):
filtered_data = filter_media_type(data_1)
unique_actors = filtered_data['cast'].unique()
print("List of all available actors:")
print(', '.join(unique_actors))
actor_input = input("Enter the name of the actor to display movies and/or series: ")
unique_types = filtered_data['listed_in'].unique()
print("\nList of all available types:")
print(', '.join(unique_types))
type_input = input("Enter the type (romantic, action, drama, etc.): ").capitalize()
actor_type_data = filtered_data[
(filtered_data['cast'].str.lower().str.contains(actor_input.lower(), case=False, na=False)) &
(filtered_data['listed_in'].str.lower().str.contains(type_input.lower(), case=False, na=False))
]
if not actor_type_data.empty:
# Display the count
count = len(actor_type_data)
print(f"The actor {actor_input} has acted in {count} movie(s) or series of type {type_input}.")
print(actor_type_data)
save_to_csv(actor_type_data)
else:
print(f"No movies or series found for the actor {actor_input} and type {type_input}.")
def most_rated(data_1):
filtered_data = filter_media_type(data_1)
# Check if the 'rating' column exists in the dataset
if 'rating' not in filtered_data.columns:
print("The dataset does not contain a 'rating' column.")
return
# Sort the data by the 'rating' column in descending order
sorted_data = filtered_data.sort_values(by='rating', ascending=False)
# Display the top-rated movies and/or series
if not sorted_data.empty:
print("Top-rated movies and/or series:")
print(sorted_data[['title', 'type', 'rating']].head(10)) # Display the top 10
save_to_csv(sorted_data)
else:
print("No rated movies or series found.")
def most_rated_year(data_1):
filtered_data = filter_media_type(data_1)
# Check if the 'rating' and 'release_year' columns exist in the dataset
if 'rating' not in filtered_data.columns or 'release_year' not in filtered_data.columns:
print("The dataset does not contain the necessary columns.")
return
year_input = input("Enter the year to show the most rated movies and/or series: ")
try:
year_input = int(year_input)
except ValueError:
print("Invalid input. Please enter a valid year.")
return
# Filter the data for the specified year
year_data = filtered_data[filtered_data['release_year'] == year_input]
if not year_data.empty:
# Sort the data by the 'rating' column in descending order
sorted_data = year_data.sort_values(by='rating', ascending=False)
# Display the top-rated movies and/or series in the specified year
print(f"\nTop-rated movies and/or series in {year_input}:")
print(sorted_data[['title', 'type', 'rating']].head(10)) # Display the top 10
save_to_csv(sorted_data)
else:
print(f"No rated movies or series found for the year {year_input}.")
def most_rated_recent(data_1):
filtered_data = filter_media_type(data_1)
# Check if the 'rating' and 'date_added' columns exist in the dataset
if 'rating' not in filtered_data.columns or 'date_added' not in filtered_data.columns:
print("The dataset does not contain the necessary columns.")
return
# Sort the data by the 'rating' column in descending order and 'date_added' in descending order
sorted_data = filtered_data.sort_values(by=['rating', 'date_added'], descending=[False, True])
# Display the most rated and recent movies and/or series
if not sorted_data.empty:
print("Most rated and recent movies and/or series:")
print(sorted_data[['title', 'type', 'rating', 'date_added']].head(10)) # Display the top 10
save_to_csv(sorted_data)
else:
print("No rated and recent movies or series found.")
# Example usage
def parental_code(data_1):
code_list = []
for codes in data_1['rating'].dropna().str.split(', '):
for code in codes:
if code not in code_list and code != '':
code_list.append(code)
print("Here are the parental codes: ")
print(code_list)
def code(data_1) :
liste_codes = []
for codes in data_1['rating'].dropna().str.split(', ') :
for code in codes :
if code not in liste_codes and code != '' :
liste_codes.append(code)
print("Voici les codes parentaux : ")
display(liste_codes)
#code_parental = input("Entrez le code de contrôle parental : PG-13, TV-MA") #code_parental = input("Entrez le code de contrôle parental : PG-13, TV-MA")
def directors_nationality(data_1):
# Check if the 'director' column exists in the dataset
if 'director' not in data_1.columns:
print("The dataset does not contain a 'director' column.")
return
# Extract unique directors and their respective nationalities
directors_nationality_dict = {}
for index, row in data_1.iterrows():
directors = row['director'].split(', ')
nationality = row['country']
for director in directors:
if director in directors_nationality_dict:
directors_nationality_dict[director]['nationalities'].add(nationality)
directors_nationality_dict[director]['count'] += 1
else:
directors_nationality_dict[director] = {'nationalities': {nationality}, 'count': 1}
# Sort the directors by the number of movies and series produced
sorted_directors = sorted(directors_nationality_dict.items(), key=lambda x: x[1]['count'], reverse=True)
# Display the list of directors and their nationalities
print("Directors and their nationalities, sorted by the number of movies and series produced:")
for director, info in sorted_directors:
print(f"{director}: {', '.join(info['nationalities'])} - {info['count']} movies/series")
save_to_csv(sorted_directors)
# Allow to filter if we want movie, tv show or both
def filter_media_type(data):
media_type = input("What type of media do you want to display? (Movie/TV Show/Both): ").lower()
if media_type in ['movie', 'tv show', 'both']:
if media_type == 'both':
return data
else:
return data[data['type'].str.lower() == media_type]
else:
print("Invalid choice. Displaying all types of media.")
return data # Return the original data if the media type choice is invalid
# Example usage
def basic_statistics(data_1):
# Check if the 'type' and 'country' columns exist in the dataset
if 'type' not in data_1.columns or 'country' not in data_1.columns:
print("The dataset does not contain the necessary columns.")
return
# Count the number of movies and series
movies_count = len(data_1[data_1['type'] == 'Movie'])
series_count = len(data_1[data_1['type'] == 'TV Show'])
print(f"Number of movies in the catalog: {movies_count}")
print(f"Number of series in the catalog: {series_count}")
# Compare the number of movies and series
if movies_count > series_count:
print("There are more movies than series in the catalog.")
elif movies_count < series_count:
print("There are more series than movies in the catalog.")
else:
print("The catalog has an equal number of movies and series.")
# List countries that produced movies/series from most productive to least
country_counts = data_1['country'].str.split(', ').explode().value_counts()
print("\nCountries that produced movies/series, sorted from most to least productive:")
print(country_counts)
save_to_csv(pd.DataFrame({'Country Count' : [country_counts], 'Movies Count': [movies_count], 'Series Count': [series_count]}), 'counts.csv')
# attention il faut demander à chaque fois, s'il désire enregistrer la liste sur un .csv # 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
data.to_csv(file_name, index=False)
print(f"Data saved to {file_name}")
# Ask if the user wants to open the file
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): ")
new_filename = new_filename + ".csv"
data.to_csv(new_filename, index=False)
print(f"Data saved to {new_filename}")
# Ask if the user wants to open the file
open_choice = input("Do you want to open the saved file? (YES/NO): ").upper()
if open_choice == 'YES':
os.system(file_name)
else:
# Save to a new file
data.to_csv(file_name, index=False)
print(f"Data saved to {file_name}")
# Ask if the user wants to open the file
open_choice = input("Do you want to open the saved file? (YES/NO): ").upper()
if open_choice == 'YES':
os.system(file_name)
else:
print("Data not saved.")
# Création du menu # Création du menu
def menu() : def action() :
print("Voici les différentes options disponibles : ") print("Here are the different options available:")
print("1. Voir tout le catalogue ") print("1. View the entire catalog")
print("2. Voir tous les films du catalogue ") print("2. View all movies in the catalog")
print("3. Voir toutes les séries") print("3. View all series")
print("4. Voir toutes les séries ou films par année") print("4. View all series, movies or both by year")
print("5. Voir toutes les séries ou films par pays") print("5. View all series, movies or both by country")
print("6. Voir toutes les séries ou films par type") print("6. View all series, movies or both by type")
print("7. Voir toutes les séries ou films par type trié par durée") print("7. View all series, movies or both by type sorted by duration")
print("8. Voir les films réalisés par un réalisateur précis et trié par année") print("8. View series, movies or both directed by a specific director and sorted by year")
print("9. Voir les films réalisés par un acteur précis et trié par année") print("9. View series, movies or both featuring a specific actor and sorted by year")
print("10. Voir combien de films et de séries réalisés par un réalisateur selon un genre précis") print("10. View how many series, movies or both and series directed by a director in a specific genre")
print("11. Voir dans combien de films et de séries un acteur a joué ") print("11. View how many series, movies or both an actor has played in")
print("12. Afficher les films ou séries les mieux notées ") print("12. Display the highest-rated series, movies or both")
print("13. Afficher les films ou séries les mieux notées en précisant une année ") print("13. Display the highest-rated series, movies or both for a specific year")
print("14. Afficher les films ou séries récents les mieux notées ") print("14. Display recent highest-rated series, movies or both")
print("15. Afficher les films et séries en fonction du code de contrôle parental ") print("15. Display movies and series based on parental control code")
print("16. Afficher la nationalités des réalisateurs et trier la liste en fonction du nombre de films et de séries réalisés") print("16. Display the nationalities of directors and sort the list based on the number of movies and series directed")
print("17. Afficher les statistiques de bases") print("17. Display basic statistics")
print("... Entrez STOP pour arrêter ") print("... Enter STOP to stop")
commande = input("Entrez le numéro de ce que vous voulez faire : ") command = input("Enter the number of what you want to do: ")
if commande == "1" :
catalogue(data_1) if command == "1" :
elif commande == "2" : catalog(data_1)
film(data_1) elif command == "2" :
elif commande == "3" : movies(data_1)
elif command == "3" :
series(data_1) series(data_1)
elif commande == "4" : elif command == "4" :
year(data_1) by_year(data_1)
elif commande == "5" : elif command == "5" :
pays(data_1) by_country(data_1)
elif commande == "6" : elif command == "6" :
typ(data_1)
elif commande == "7" :
duree(data_1)
elif commande == "8" :
real(data_1)
elif commande == "9" :
acteur(data_1)
elif commande == "10" :
genre(data_1) genre(data_1)
elif commande == "11" : elif command == "7" :
played(data_1) duration(data_1)
elif commande == "12" : elif command == "8" :
rated(data_1) director(data_1)
elif commande == "13" : elif command == "9" :
rated_year(data_1) actor(data_1)
elif commande == "14" : elif command == "10" :
rated_recent(data_1) specific_genre_director(data_1)
elif commande == "15" : elif command == "11" :
code(data_1) specific_genre_actor(data_1)
elif commande == "16" : elif command == "12" :
nationalite(data_1) most_rated(data_1)
elif commande == "17" : elif command == "13" :
stats(data_1) most_rated_year(data_1)
elif commande == "STOP" : elif command == "14" :
most_rated_recent(data_1)
elif command == "15" :
parental_code(data_1)
elif command == "16" :
directors_nationality(data_1)
elif command == "17" :
basic_statistics(data_1)
elif command == "..." :
return False return False
...@@ -288,17 +565,14 @@ def menu() : ...@@ -288,17 +565,14 @@ def menu() :
menu() menu = []
menu_liste = []
while True: while True:
rep = menu() response = action()
if rep is False: if response is False:
break break
else: else:
if rep == True: if response == True:
menu_list = [] menu = []
else: else:
menu_list.append(rep) menu.append(response)
\ No newline at end of file \ No newline at end of file
Impossible d'afficher diff de source : il est trop volumineux. Options pour résoudre ce problème : voir le blob.
Impossible d'afficher diff de source : il est trop volumineux. Options pour résoudre ce problème : voir le blob.
...@@ -828,14 +828,14 @@ def calculate_student_stats(row, numeric_columns): ...@@ -828,14 +828,14 @@ def calculate_student_stats(row, numeric_columns):
def action(): def action():
print("What do you want to do?\nBelow, you will find what is possible followed by the commands to type.") print("What do you want to do?\nBelow, you will find what is possible followed by the commands to type.")
print("1. Register a student") print("1. Register a student")
print("2. Modify one or more fields") print("2. Modify one or more fields")
print("3. Delete a student") print("3. Delete a student")
print("4. Find a student") print("4. Find a student")
print("5. Show") print("5. Show")
print("6. Sort, display, or export the list") print("6. Sort, display, or export the list")
print("7. View statistics") print("7. View statistics")
print("8. Stop the program") print("... To stop the program")
while True: while True:
command = input("Enter the number of what you want to do: ") # Check if the command is an integer command = input("Enter the number of what you want to do: ") # Check if the command is an integer
...@@ -861,7 +861,7 @@ def action(): ...@@ -861,7 +861,7 @@ def action():
sort(data) sort(data)
elif command == "7": elif command == "7":
statistics_analysis(data) statistics_analysis(data)
elif command == "8": elif command == "...":
return False return False
menu = [] menu = []
......
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