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

last update

parent 3b82f319
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
......@@ -5,6 +5,7 @@ import statistics
import re
from IPython.display import display
from tabulate import tabulate
from fuzzywuzzy import process
all_course_BAC1 = ("Anglais 1", "Fondements du droit public", "Fondements du droit de l'entreprise", "Economie", "Espagnol 1", "Comptabilité", "Informatique de gestion", "Mathématiques de gestion 1", "Statistiques et probabilités", "Pilosophie", "Psychologie", "Sociologie", "Séminaire de travail universitaire en gestion")
......@@ -166,6 +167,35 @@ def register_student(data):
register(data, Firstname, Lastname, Curriculum, Date_of_birth, Place_of_birth, Address, Telephone, Email, Gender, Academic_year, Courses_and_grade, Campus)
# Display the entered information
print("\nEntered Information:")
print(f"Firstname: {Firstname}")
print(f"Lastname: {Lastname}")
print(f"Date of Birth: {Date_of_birth}")
print(f"Place of Birth: {Place_of_birth}")
print(f"Address: {Address}")
print(f"Telephone: {Telephone}")
print(f"Email: {Email}")
print(f"Gender: {Gender}")
print(f"Academic Year: {Academic_year}")
print(f"Curriculum: {Curriculum}")
print(f"Courses and Grades: {Courses_and_grade}")
print(f"Campus: {Campus}")
while True:
# Ask the user if they want to modify any information before registration
modify_info = input("Do you want to modify any information before registration? (YES/NO): ").upper()
if modify_info == "YES":
modify(data) # Call the modify function to update information
break # Exit the loop after modification
elif modify_info == "NO":
break # Exit the loop if no modification is needed
else:
print("Invalid input. Please enter either 'YES' or 'NO'.")
return
def register(data, firstname, lastname,Curriculum, date_of_birth, place_of_birth, address, telephone, email, gender, academic_year, courses_and_grade, campus):
matricule = generate_matricule(firstname, lastname, date_of_birth)
......@@ -228,15 +258,15 @@ def modify(data):
student_index = student_row.index[0]
print(f"\nModifying the student with matricule {matricule_to_modify}:\n")
print("1. Firstname")
print("2. Lastname")
print("3. Date of Birth")
print("4. Place of Birth")
print("5. Address")
print("6. Telephone")
print("7. Email")
print("8. Sex (M | F | O)")
print("9. Academic Year")
print("1. Firstname")
print("2. Lastname")
print("3. Date of Birth")
print("4. Place of Birth")
print("5. Address")
print("6. Telephone")
print("7. Email")
print("8. Sex (M | F | O)")
print("9. Academic Year")
print("10. Curriculum")
print("11. Courses already passed and their grade")
print("12. Campus")
......@@ -253,7 +283,7 @@ def modify(data):
print(f"The firstname is valid : {firstname}")
if field_to_modify in (1, 2, 3):
matricule = generate_matricule(firstname, data.at[student_index, 'Lastname'], data.at[student_index, 'Date of Birth'])
data.at[student_index, 'Firstame'] = firstname
data.at[student_index, 'Firstname'] = firstname
break # Exit the loop if the name is valid
else:
print("The name is not valid. Make sure to follow the specified format.")
......@@ -458,26 +488,28 @@ def delete(data):
# FIND
def find_student(data):
print("Below the search criteria : ")
print("Below are the search criteria:")
print("1. By his/her lastname")
print("2. By his/her firstname")
print("3. By his/her matricule")
search_criteria = input("Enter the number of what you want to do: ")
if search_criteria == "1":
surname_search = input("Enter the lastname of the student: ")
results = data[data['Lastname'].str.contains(surname_search, case=False, na=False)]
elif search_criteria == "2":
name_search = input("Enter the firstname of the student: ")
results = data[data['Firstname'].str.contains(name_search, case=False, na=False)]
elif search_criteria == "3":
matricule_search = input("Enter the matricule of the student: ")
results = data[data['Matricule'].str.contains(matricule_search, case=False, na=False)]
else:
print("Invalid search criteria.")
return
while True:
search_criteria = input("Enter the number of what you want to do: ")
if search_criteria == "1":
surname_search = input("Enter the lastname of the student: ")
results = find_similar_data(data['Lastname'], surname_search, 'Lastname')
break
elif search_criteria == "2":
name_search = input("Enter the firstname of the student: ")
results = find_similar_data(data['Firstname'], name_search, 'Firstname')
break
elif search_criteria == "3":
matricule_search = input("Enter the matricule of the student: ")
results = find_similar_data(data['Matricule'], matricule_search, 'Matricule')
break
else:
print("Invalid search criteria. Please enter a valid number.")
if results.empty:
print("No student found with the specified criteria.")
......@@ -486,6 +518,18 @@ def find_student(data):
for index, row in results.iterrows():
print(f"Firstname: {row['Firstname']}, Lastname: {row['Lastname']}, Matricule: {row['Matricule']}")
def find_similar_data(column, search_term, column_name):
# Using fuzzywuzzy to find similar values in the specified column
results = process.extractBests(search_term, column, score_cutoff=80) # You can adjust the score_cutoff as needed
similar_values = [result[0] for result in results]
# Display suggestions if there are similar values
if similar_values:
print(f"Suggestions for {column_name}: {', '.join(similar_values)}")
# Filter the DataFrame based on similar values
filtered_data = column.isin(similar_values)
return data[filtered_data]
# SHOW
def filter_students(data):
......@@ -874,7 +918,7 @@ def action():
print("5. Show")
print("6. Sort, display, or export the list")
print("7. View statistics")
print("... To stop the program")
print("8. To stop the program")
while True:
command = input("Enter the number of what you want to do: ") # Check if the command is an integer
......@@ -900,7 +944,7 @@ def action():
sort(data)
elif command == "7":
statistics_analysis(data)
elif command == "...":
elif command == "8":
return False
menu = []
......
Fichier ajouté
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