Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

2.

Analyze Per Student:

def analyze_per_student(data):
results = []
for index, row in data.iterrows():
name = row['Tên']
scores = row[2:] # Adjust index based on actual data structure
average = scores.mean()
max_score = scores.max()
min_score = scores.min()
categories = categorize_scores(scores)
results.append([name, average, max_score, min_score] + categories)
write_to_file(results, 'phantich_theoHD.txt')

3. Analyze Per Subject:

def analyze_per_subject(data):
subjects = data.columns[2:] # Adjust index based on actual data structure
results = []
for subject in subjects:
subject_scores = data[subject]
sorted_scores = subject_scores.sort_values(ascending=False)
average = subject_scores.mean()
max_score = subject_scores.max()
min_score = subject_scores.min()
categories = categorize_scores(subject_scores)
results.append([subject, sorted_scores, max_score, min_score, average] +
categories)
write_to_file(results, 'phantich_theoMon.txt')

4. Evaluate for Rewards:

def evaluate_rewards(data):
results = []
for index, row in data.iterrows():
name = row['Tên']
scores = row[2:] # Adjust index based on actual data structure
points = 0
for score in scores:
if score >= 8: # Assuming "Tốt" is 8 or above
points += 1
elif score < 5: # Assuming below "Khá" is under 5
points -= 1
results.append([name, points])
write_to_file(results, 'xetKhenThuong.txt')

You might also like